Zend php.ini在命令行上抛出错误

时间:2011-12-06 14:54:50

标签: command-line zend-server php-ini

我尝试在命令行上运行zend框架脚本。 这很好用,但每次我执行一个PHP脚本它给我 很多警告和错误回来了,有什么问题?我该如何解决这个问题?

我把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 个答案:

答案 0 :(得分:1)

我假设您使用mac os x!? 在命令行上使用php时,这是从/usr/bin调用php的位置。要确保使用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您创建指向此文件的符号链接(首选方法!)

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