php-i | "EXTENSION_DIR" bulmak

4 Cevap

i php script Kıvrılmaları kullanarak istiyorum ve komut satırı modunda çalıştırın.

Burada script

<?php
 //enable_dl("php_curl.dll");
 $ch = curl_init();
 $options=array(
  CURLOPT_URL=>"http://test.com/wp-content/themes/bluefocus/images/desc_img.jpg",
  CURLOPT_BINARYTRANSFER=>true,
  CURLOPT_VERBOSE=>true
 );
 curl_setopt_array($ch,$options);
    $data = curl_exec($ch);
 $fp=fopen("test.jpg","w");
 fwrite($fp,$data);
 curl_close($ch);
?>

i komutu ile cmd çalıştırmak php get.php

hata mesajı:

D:\project>php get.php

Fatal error: Call to undefined function curl_init() in D:\project\gals_curl_batch_download\get.php on line 3

web sayfası çıktı phpinfo () curl devrede gösteriyor

cURL support  enabled
cURL Information  libcurl/7.19.4 OpenSSL/0.9.8k zlib/1.2.3 

and here is the strange thing phpinfo() int the webpage output show, in fact extension enabled in php.ini can be run in web page. the exact directory of the extension is under ./ext

extension_dir ./ext ./ext

ama php-i | "EXTENSION_DIR" bulmak her zaman bu göstermek ve php.ini dosyasında ile modifiye edilemez

extension_dir => C:\php5 => C:\php5

restarted apache several times, keeps the same error. so I wonder why the value of extension_dir can't be modified.

4 Cevap

hey guys, i've found the answer to the question. just because php -i and phpinfo() in the web script using different php.ini files.

i ciddi php-i ve phpinfo () farklı çıkışında bir göz atın.

Burada fark geliyor:

phpinfo():

Server API Apache 2.0 Handler

Configuration File (php.ini) Path C:\Windows

Loaded Configuration File D:\phpnow\php-5.2.10-Win32\php-apache2handler.ini

php -i

Server API => Komut Satırı Arabirimi

Yapılandırma Dosyası (php.ini) Path => C: \ Windows

Loaded Configuration File => (yok)

önemli sorun php-i bir php.ini bekliyorduk ama hiçbir şey yüklemek.

\ Windows dizini: c php.ini dosya kopyalamaya çalışın. PHP 5.3.5 kullanıyorum. ve ben Windows aynı problem vardı. Ben c php.ini dosyasını kopyaladığınız zaman: \ windows, extension_dir düzgün ayarlanmış ve benim grafik programı çalışmaya başladı.

Eğer extension=php_curl.dll php.ini eklemeyi denediniz mi?

FWIW, CLI için phpinfo kontrol etmek için en iyi yolu muhtemelen:

$ php -i | fgrep -i curl
Configure Command =>  '/SourceCache/apache_mod_php/apache_mod_php-44.4/php/configure'  '--prefix=/usr' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--disable-dependency-tracking' '--with-apxs2=/usr/sbin/apxs' '--with-ldap=/usr' '--with-kerberos=/usr' '--enable-cli' '--with-zlib-dir=/usr' '--enable-trans-sid' '--with-xml' '--enable-exif' '--enable-ftp' '--enable-mbstring' '--enable-mbregex' '--enable-dbx' '--enable-sockets' '--with-iodbc=/usr' '--with-curl=/usr' '--with-config-file-path=/etc' '--sysconfdir=/private/etc' '--with-mysql-sock=/var/mysql' '--with-mysqli=/usr/bin/mysql_config' '--with-mysql=/usr' '--with-openssl' '--with-xmlrpc' '--with-xsl=/usr' '--without-pear'
curl
cURL suppveyat => enabled
cURL Infveyamation => libcurl/7.16.3 OpenSSL/0.9.7l zlib/1.2.3
$

php -i temel olarak phpinfo() CLI eşdeğerdir

Ayrıca, PHP CLI (farklı bir dosya kullanıyveya eğer ki bir de düzenlenmiş ettik emin olun, ya da) aynı php.ini kullanmak üzere yapılandırılmış olduğunu çift kontrol. Bazen PHP farklı php.inis PHP nasıl çağrılır bağlı olarak ile ayarlanabilir - Ben Debian ve Ubuntu bunu inanıyveyaum, özellikle.

Kullanılan php.ini dosyasını Belirlenmesi:

$ php -i | fgrep Configuration
Configuration File (php.ini) Path => /etc
Loaded Configuration File => /etc/php.ini
$

veya

$ php --ini
Configuration File (php.ini) Path: /etc
Loaded Configuration File:         /etc/php.ini
Scan fveya additional .ini files in: /etc/php.d
Additional .ini files parsed:      /etc/php.d/apc.ini,
/etc/php.d/dbase.ini,
/etc/php.d/dom.ini,
/etc/php.d/gd.ini,
/etc/php.d/imagick.ini,
/etc/php.d/json.ini,
/etc/php.d/mbstring.ini,
/etc/php.d/memcache.ini,
/etc/php.d/mysql.ini,
/etc/php.d/mysqli.ini,
/etc/php.d/pdo.ini,
/etc/php.d/pdo_mysql.ini,
/etc/php.d/pdo_pgsql.ini,
/etc/php.d/pdo_sqlite.ini,
/etc/php.d/pgsql.ini,
/etc/php.d/tidy.ini,
/etc/php.d/xdebug.ini,
/etc/php.d/xmlreader.ini,
/etc/php.d/xmlwriter.ini,
/etc/php.d/xsl.ini,
/etc/php.d/zip.ini

Working with php 5.4.4. with Windows 7 and Apache 2.2. Running phpinfo() showed that the value assigned to extension_dir wasn't matching the setting in php.ini

Ama php.ini was kesinlikle okunuyor.

My suspicion is that extension_dir needs a reboot in Windows and the PATH set. Other settings in php.ini just need an Apache restart.