2011-12-06 159 views
1

我嘗試在命令行上運行zend框架腳本。 這個效果很好,但每次我執行一個php腳本時,它都會給我提供很多警告和錯誤,問題是什麼?我該如何解決這個問題?Zend php.ini在命令行上拋出錯誤

我把zend php.ini放在/ etc /因爲這個目錄是我的命令行默認使用的,當我嘗試使用'php -c/usr/local/zend/etc/script.php'它給了我同樣的錯誤。

來自命令行的錯誤;

leny-pc:scripts nickyklaasse$ php -i | grep php.ini 
    Failed loading /usr/local/zend/lib/ZendExtensionManager.so: dlopen(/usr/local/zend/lib/ZendExtensionManager.so, 9): no suitable image found. Did find: 
    /usr/local/zend/lib/ZendExtensionManager.so: mach-o, but wrong architecture 
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/zend/lib/php_extensions/bcmath.so' - dlopen(/usr/local/zend/lib/php_extensions/bcmath.so, 9): no suitable image found. Did find: 
    /usr/local/zend/lib/php_extensions/bcmath.so: mach-o, but wrong architecture in Unknown on line 0 
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/zend/lib/php_extensions/calendar.so' - dlopen(/usr/local/zend/lib/php_extensions/calendar.so, 9): no suitable image found. Did find: 
    /usr/local/zend/lib/php_extensions/calendar.so: mach-o, but wrong architecture in Unknown on line 0 
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/zend/lib/php_extensions/curl.so' - dlopen(/usr/local/zend/lib/php_extensions/curl.so, 9): no suitable image found. Did find: 
    /usr/local/zend/lib/php_extensions/curl.so: mach-o, but wrong architecture in Unknown on line 0 
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/zend/lib/php_extensions/exif.so' - dlopen(/usr/local/zend/lib/php_extensions/exif.so, 9): no suitable image found. Did find: 
    /usr/local/zend/lib/php_extensions/exif.so: mach-o, but wrong architecture in Unknown on line 0 
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/zend/lib/php_extensions/ftp.so' - dlopen(/usr/local/zend/lib/php_extensions/ftp.so, 9): no suitable image found. Did find: 
    /usr/local/zend/lib/php_extensions/ftp.so: mach-o, but wrong architecture in Unknown on line 0 
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/zend/lib/php_extensions/gettext.so' - dlopen(/usr/local/zend/lib/php_extensions/gettext.so, 9): no suitable image found. Did find: 
    /usr/local/zend/lib/php_extensions/gettext.so: mach-o, but wrong architecture in Unknown on line 0 
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/zend/lib/php_extensions/posix.so' - dlopen(/usr/local/zend/lib/php_extensions/posix.so, 9): no suitable image found. Did find: 
    /usr/local/zend/lib/php_extensions/posix.so: mach-o, but wrong architecture in Unknown on line 0 
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/zend/lib/php_extensions/soap.so' - dlopen(/usr/local/zend/lib/php_extensions/soap.so, 9): no suitable image found. Did find: 
    /usr/local/zend/lib/php_extensions/soap.so: mach-o, but wrong architecture in Unknown on line 0 
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/zend/lib/php_extensions/sqlite.so' - dlopen(/usr/local/zend/lib/php_extensions/sqlite.so, 9): no suitable image found. Did find: 
    /usr/local/zend/lib/php_extensions/sqlite.so: mach-o, but wrong architecture in Unknown on line 0 
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/zend/lib/php_extensions/tokenizer.so' - dlopen(/usr/local/zend/lib/php_extensions/tokenizer.so, 9): no suitable image found. Did find: 
    /usr/local/zend/lib/php_extensions/tokenizer.so: mach-o, but wrong architecture in Unknown on line 0 
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/zend/lib/php_extensions/xmlreader.so' - dlopen(/usr/local/zend/lib/php_extensions/xmlreader.so, 9): no suitable image found. Did find: 
    /usr/local/zend/lib/php_extensions/xmlreader.so: mach-o, but wrong architecture in Unknown on line 0 
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/zend/lib/php_extensions/xsl.so' - dlopen(/usr/local/zend/lib/php_extensions/xsl.so, 9): no suitable image found. Did find: 
    /usr/local/zend/lib/php_extensions/xsl.so: mach-o, but wrong architecture in Unknown on line 0 
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/zend/lib/php_extensions/zip.so' - dlopen(/usr/local/zend/lib/php_extensions/zip.so, 9): no suitable image found. Did find: 
    /usr/local/zend/lib/php_extensions/zip.so: mach-o, but wrong architecture in Unknown on line 0 
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/zend/lib/php_extensions/imap.so' - dlopen(/usr/local/zend/lib/php_extensions/imap.so, 9): no suitable image found. Did find: 
    /usr/local/zend/lib/php_extensions/imap.so: mach-o, but wrong architecture in Unknown on line 0 
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/zend/lib/php_extensions/ldap.so' - dlopen(/usr/local/zend/lib/php_extensions/ldap.so, 9): no suitable image found. Did find: 
    /usr/local/zend/lib/php_extensions/ldap.so: mach-o, but wrong architecture in Unknown on line 0 
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/zend/lib/php_extensions/mysql.so' - dlopen(/usr/local/zend/lib/php_extensions/mysql.so, 9): no suitable image found. Did find: 
    /usr/local/zend/lib/php_extensions/mysql.so: mach-o, but wrong architecture in Unknown on line 0 
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/zend/lib/php_extensions/mysqli.so' - dlopen(/usr/local/zend/lib/php_extensions/mysqli.so, 9): no suitable image found. Did find: 
    /usr/local/zend/lib/php_extensions/mysqli.so: mach-o, but wrong architecture in Unknown on line 0 
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/zend/lib/php_extensions/json.so' - dlopen(/usr/local/zend/lib/php_extensions/json.so, 9): no suitable image found. Did find: 
    /usr/local/zend/lib/php_extensions/json.so: mach-o, but wrong architecture in Unknown on line 0 
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/zend/lib/php_extensions/tidy.so' - dlopen(/usr/local/zend/lib/php_extensions/tidy.so, 9): no suitable image found. Did find: 
    /usr/local/zend/lib/php_extensions/tidy.so: mach-o, but wrong architecture in Unknown on line 0 
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/zend/lib/php_extensions/pgsql.so' - dlopen(/usr/local/zend/lib/php_extensions/pgsql.so, 9): no suitable image found. Did find: 
    /usr/local/zend/lib/php_extensions/pgsql.so: mach-o, but wrong architecture in Unknown on line 0 
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/zend/lib/php_extensions/gd.so' - dlopen(/usr/local/zend/lib/php_extensions/gd.so, 9): no suitable image found. Did find: 
    /usr/local/zend/lib/php_extensions/gd.so: mach-o, but wrong architecture in Unknown on line 0 
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/zend/lib/php_extensions/mcrypt.so' - dlopen(/usr/local/zend/lib/php_extensions/mcrypt.so, 9): no suitable image found. Did find: 
    /usr/local/zend/lib/php_extensions/mcrypt.so: mach-o, but wrong architecture in Unknown on line 0 
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/zend/lib/php_extensions/ctype.so' - dlopen(/usr/local/zend/lib/php_extensions/ctype.so, 9): no suitable image found. Did find: 
    /usr/local/zend/lib/php_extensions/ctype.so: mach-o, but wrong architecture in Unknown on line 0 
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/zend/lib/php_extensions/sockets.so' - dlopen(/usr/local/zend/lib/php_extensions/sockets.so, 9): no suitable image found. Did find: 
    /usr/local/zend/lib/php_extensions/sockets.so: mach-o, but wrong architecture in Unknown on line 0 
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/zend/lib/php_extensions/bz2.so' - dlopen(/usr/local/zend/lib/php_extensions/bz2.so, 9): no suitable image found. Did find: 
    /usr/local/zend/lib/php_extensions/bz2.so: mach-o, but wrong architecture in Unknown on line 0 
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/zend/lib/php_extensions/mbstring.so' - dlopen(/usr/local/zend/lib/php_extensions/mbstring.so, 9): no suitable image found. Did find: 
    /usr/local/zend/lib/php_extensions/mbstring.so: mach-o, but wrong architecture in Unknown on line 0 
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/zend/lib/php_extensions/intl.so' - dlopen(/usr/local/zend/lib/php_extensions/intl.so, 9): no suitable image found. Did find: 
    /usr/local/zend/lib/php_extensions/intl.so: mach-o, but wrong architecture in Unknown on line 0 
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/zend/lib/php_extensions/fileinfo.so' - dlopen(/usr/local/zend/lib/php_extensions/fileinfo.so, 9): no suitable image found. Did find: 
    /usr/local/zend/lib/php_extensions/fileinfo.so: mach-o, but wrong architecture in Unknown on line 0 
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/zend/lib/php_extensions/phar.so' - dlopen(/usr/local/zend/lib/php_extensions/phar.so, 9): no suitable image found. Did find: 
    /usr/local/zend/lib/php_extensions/phar.so: mach-o, but wrong architecture in Unknown on line 0 
Configuration File (php.ini) Path => /etc 
Loaded Configuration File => /private/etc/php.ini 

謝謝諮詢,

尼基

回答

1

我假設你使用Mac OS X!? 在命令行上使用php時,這是從以下位置調用php的位置:/usr/bin。爲了確保您使用的是與Zend服務器一起提供的PHP版本,您必須替換位於/usr/bin的原生php。

首先備份您的本機PHP文件:

sudo mv /usr/bin/php /usr/bin/php.bak 
sudo mv /usr/bin/php-cli /usr/bin/php-cli.bak 
sudo mv /usr/bin/php-config /usr/bin/php-config.bak 
sudo mv /usr/bin/phpize /usr/bin/phpize.bak 

要麼你上面的文件複製從/usr/local/zend/bin/usr/bin OR 創建符號鏈接到這個文件(首選方法!):

sudo ln -s /usr/local/zend/bin/php-config ./php-config等等......

最後/usr/bin應該看起來類似於這樣:

lrwxr-xr-x  1 root wheel  23 6 Feb 17:40 php -> /usr/local/zend/bin/php 
lrwxr-xr-x  1 root wheel  27 25 Dez 23:43 php-cli -> /usr/local/zend/bin/php-cli 
-rwxr-xr-x  1 root wheel  23 25 Dez 23:43 php-cli.bak 
lrwxr-xr-x  1 root wheel  30 6 Feb 17:42 php-config -> /usr/local/zend/bin/php-config 
-rwxr-xr-x  1 root wheel  3776 6 Feb 15:09 php-config.bak 
-rwxr-xr-x  1 root wheel 21488656 6 Feb 15:09 php.bak 
lrwxr-xr-x  1 root wheel  26 25 Dez 23:44 phpize -> /usr/local/zend/bin/phpize 
-rwxr-xr-x  1 root wheel  26 25 Dez 23:44 phpize.bak