Apache 重启后不会加载新的 php.ini

Apache 重启后不会加载新的 php.ini

以前从未遇到过这个问题,直到今天更新 CPanel?也许这就是问题的一部分?

我只有一个 php.ini 文件

# /usr/local/bin/php --info | grep php.ini
Configure Command =>  './configure'  '--disable-cgi' '--disable-fileinfo' '--enable-bcmath' '--enable-calendar' '--enable-exif' '--enable-ftp' '--enable-gd-native-ttf' '--enable-libxml' '--enable-magic-quotes' '--enable-mbstring' '--enable-pdo=shared' '--enable-soap' '--enable-sockets' '--enable-zip' '--prefix=/usr/local' '--with-bz2' '--with-config-file-path=/usr/local/lib' '--with-config-file-scan-dir=/usr/local/lib/php.ini.d' '--with-curl=/opt/curlssl/' '--with-curlwrappers' '--with-freetype-dir=/usr' '--with-gd' '--with-imap=/opt/php_with_imap_client/' '--with-imap-ssl=/usr' '--with-jpeg-dir=/usr' '--with-kerberos' '--with-libdir=lib64' '--with-libexpat-dir=/usr' '--with-libxml-dir=/opt/xml2' '--with-libxml-dir=/opt/xml2/' '--with-mcrypt=/opt/libmcrypt/' '--with-mysql=/usr' '--with-mysql-sock=/var/lib/mysql/mysql.sock' '--with-mysqli=/usr/bin/mysql_config' '--with-openssl=/usr' '--with-openssl-dir=/usr' '--with-pcre-regex=/opt/pcre' '--with-pdo-mysql=shared' '--with-pdo-sqlite=shared' '--with-pic' '--with-png-dir=/usr' '--with-pspell' '--with-sqlite=shared' '--with-tidy=/opt/tidy/' '--with-xmlrpc' '--with-xpm-dir=/usr' '--with-xsl=/opt/xslt/' '--with-zlib' '--with-zlib-dir=/usr' '--with-gettext'
Configuration File (php.ini) Path => /usr/local/lib
Loaded Configuration File => /usr/local/lib/php.ini
Scan this dir for additional .ini files => /usr/local/lib/php.ini.d

# /usr/bin/php --info | grep php.ini
<tr><td class="e">Configure Command </td><td class="v"> &#039;./configure&#039;  &#039;--disable-fileinfo&#039; &#039;--enable-bcmath&#039; &#039;--enable-calendar&#039; &#039;--enable-exif&#039; &#039;--enable-ftp&#039; &#039;--enable-gd-native-ttf&#039; &#039;--enable-libxml&#039; &#039;--enable-magic-quotes&#039; &#039;--enable-mbstring&#039; &#039;--enable-pdo=shared&#039; &#039;--enable-soap&#039; &#039;--enable-sockets&#039; &#039;--enable-zip&#039; &#039;--prefix=/usr&#039; &#039;--with-bz2&#039; &#039;--with-config-file-path=/usr/local/lib&#039; &#039;--with-config-file-scan-dir=/usr/local/lib/php.ini.d&#039; &#039;--with-curl=/opt/curlssl/&#039; &#039;--with-curlwrappers&#039; &#039;--with-freetype-dir=/usr&#039; &#039;--with-gd&#039; &#039;--with-imap=/opt/php_with_imap_client/&#039; &#039;--with-imap-ssl=/usr&#039; &#039;--with-jpeg-dir=/usr&#039; &#039;--with-kerberos&#039; &#039;--with-libdir=lib64&#039; &#039;--with-libexpat-dir=/usr&#039; &#039;--with-libxml-dir=/opt/xml2&#039; &#039;--with-libxml-dir=/opt/xml2/&#039; &#039;--with-mcrypt=/opt/libmcrypt/&#039; &#039;--with-mysql=/usr&#039; &#039;--with-mysql-sock=/var/lib/mysql/mysql.sock&#039; &#039;--with-mysqli=/usr/bin/mysql_config&#039; &#039;--with-openssl=/usr&#039; &#039;--with-openssl-dir=/usr&#039; &#039;--with-pcre-regex=/opt/pcre&#039; &#039;--with-pdo-mysql=shared&#039; &#039;--with-pdo-sqlite=shared&#039; &#039;--with-pic&#039; &#039;--with-png-dir=/usr&#039; &#039;--with-pspell&#039; &#039;--with-sqlite=shared&#039; &#039;--with-tidy=/opt/tidy/&#039; &#039;--with-xmlrpc&#039; &#039;--with-xpm-dir=/usr&#039; &#039;--with-xsl=/opt/xslt/&#039; &#039;--with-zlib&#039; &#039;--with-zlib-dir=/usr&#039; </td></tr>
<tr><td class="e">Configuration File (php.ini) Path </td><td class="v">/usr/local/lib </td></tr>
<tr><td class="e">Loaded Configuration File </td><td class="v">/usr/local/lib/php.ini </td></tr>
<tr><td class="e">Scan this dir for additional .ini files </td><td class="v">/usr/local/lib/php.ini.d </td></tr>

每次我重启 Apache 时,我似乎仍在运行旧版本。没有任何变化。

我从 php.ini 中删除了 phpinfo() 和 ini_set() 但仍然无法使用它们。

# service httpd -k restart
[Fri Oct 26 15:27:10 2012] [warn] module hostinglimits_module is already loaded, skipping
[Fri Oct 26 15:27:10 2012] [warn] NameVirtualHost 127.0.0.1:8081 has no VirtualHosts

vhosts 或 .htaccess 下也没有 php.ini 文件。

# /usr/bin/php -v
PHP 5.3.15 (cgi-fcgi) (built: Aug  4 2012 21:33:58)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies
    with eAccelerator v0.9.6.1, Copyright (c) 2004-2010 eAccelerator, by eAccelerator
    with the ionCube PHP Loader v4.2.2, Copyright (c) 2002-2012, by ionCube Ltd., and
    with Zend Guard Loader v3.3, Copyright (c) 1998-2010, by Zend Technologies
    with Suhosin v0.9.33, Copyright (c) 2007-2012, by SektionEins GmbH

# /usr/local/bin/php -v
PHP 5.3.15 (cli) (built: Aug  4 2012 21:34:27)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies
    with eAccelerator v0.9.6.1, Copyright (c) 2004-2010 eAccelerator, by eAccelerator
    with the ionCube PHP Loader v4.2.2, Copyright (c) 2002-2012, by ionCube Ltd., and
    with Zend Guard Loader v3.3, Copyright (c) 1998-2010, by Zend Technologies
    with Suhosin v0.9.33, Copyright (c) 2007-2012, by SektionEins GmbH

错误日志中也没有显示任何内容。我们收到的唯一错误是在 vhost 下,error_log 指出 phpinfo 和 ini_set 被禁用。

编辑:两个 php 二进制文件都使用相同的 php.ini 文件

编辑:使用 suexec 将 php 作为 mod_fgcid.so 运行

编辑:从 SSH 中,我看到从两个二进制文件加载的 php.ini 文件中的 PHP 正确值

当使用来自 apache 的 php 时 [2012 年 10 月 26 日 20:25:34 UTC] PHP 警告:出于安全原因,/home/jake/public_html/phpinfo.php 第 1 行中的 phpinfo() 已被禁用

编辑:/usr/bin/php 是正确的 PHP 文件。忘记提了。它是包装器脚本中的一个。

答案1

由于您的服务器上安装了多个 PHP,因此您需要指定要加载的默认 PHP 模块。这可以通过 中的 root WHM 来完成Home »Service Configuration »Configure PHP and suEXEC。选择正确的版本,然后保存并重新启动 Apache。

答案2

看起来你有多个 php,最好的办法是创建一个简单的phpinfo();脚本,看看它使用哪个 php.ini,并确保你正在编辑正确的 php.ini(如果文件不存在,你可能需要将它符号链接到另一个或从源树中复制一个新的)。

相关内容