1

每当我尝试运行 PHP 文件(例如我将用于 cron 任务的文件)时,我都会收到以下错误:

[root@server1 ~]# php
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr//20100525/apc.so' -        /usr//20100525/apc.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr//20100525/curl.so' - /usr//20100525/curl.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr//20100525/fileinfo.so' - /usr//20100525/fileinfo.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr//20100525/imap.so' - /usr//20100525/imap.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr//20100525/json.so' - /usr//20100525/json.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr//20100525/mcrypt.so' - /usr//20100525/mcrypt.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr//20100525/mysqli.so' - /usr//20100525/mysqli.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr//20100525/phar.so' - /usr//20100525/phar.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr//20100525/sqlite3.so' - /usr//20100525/sqlite3.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr//20100525/wddx.so' - /usr//20100525/wddx.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr//20100525/zip.so' - /usr//20100525/zip.so: cannot open shared object file: No such file or directory in Unknown on line 0

我假设它与它试图从中加载扩展的事实有关,/usr//20100525但我不确定扩展在哪里

编辑:

我的 PHP 配置之一一定有问题。我重新安装了 PHP,现在一切似乎都在正常工作!

4

3 回答 3

0

您是否编辑了文件extension_dir中的设置php.ini?默认情况下它是空白的,并且php在正确的位置找到它的扩展。您可以通过添加以下行来强制它:

extension_dir = "/usr/lib64/php/modules"

你说当它在 Apache 中运行时你没有问题,只有当它作为脚本运行时。请记住,php.init每个文件都有单独的文件,例如:

$ locate /php.ini | grep ini$
/etc/php5/apache2/php.ini
/etc/php5/cli/php.ini
于 2013-10-05T05:54:18.467 回答
0

您需要使用符号链接:

ln -s /usr/lib64/php/modules /usr/20100525
于 2013-10-05T05:33:20.823 回答
0

我也遇到了这个错误,所以我用这种方式解决了这个问题试试这个

我去了 CPanel 中的 PHP Config,然后单击“安装 php.ini 主文件”恢复了我的 php.ini 主文件。然后它在您的 public_html 主目录中创建了一个名为 php.ini.default 的文件。我刚刚备份了旧的 php.ini 文件,并将 php.ini.default 重命名为 php.ini。

之后,我转到安装了损坏的 WP 实例的目录,并将它们自己的 php.ini 文件重命名为 php.ini.back,以便使用主 php.ini 文件。

而已。希望能帮助到你。

于 2013-10-05T05:35:13.517 回答