我试着模仿你的情况:
~]$ php --ini
Configuration File (php.ini) Path: /etc
Loaded Configuration File: /etc/php.ini
Scan for additional .ini files in: /etc/php.d
Additional .ini files parsed: /etc/php.d/curl.ini,
/etc/php.d/fileinfo.ini,
/etc/php.d/json.ini,
/etc/php.d/mbstring.ini,
/etc/php.d/phar.ini,
/etc/php.d/zip.ini
所以我去 /etc/php.ini 并取消注释带有“(”的行之一
~]$ vi /etc/php.ini
[PHP]
;;;;;;;;;;;;;;;;;;;
; About php.ini ;
;;;;;;;;;;;;;;;;;;;
; PHP's initialization file, generally called php.ini, is responsible for
; configuring many of the aspects of PHP's behavior.
; PHP attempts to find and load this configuration from a number of locations.
; The following is a summary of its search order:
; 1. SAPI module specific location.
; 2. The PHPRC environment variable. (As of PHP 5.2.0)
; 3. A number of predefined registry keys on Windows (As of PHP 5.2.0)
; 4. Current working directory (except CLI)
; 5. The web server's directory (for SAPI modules), or directory of PHP
(otherwise in Windows)
; 6. The directory from the --with-config-file-path compile time option, or the
现在我检查是否有错误通知:
~]$ php --ini
PHP: syntax error, unexpected '(' in /etc/php.ini on line 16
Configuration File (php.ini) Path: /etc
Loaded Configuration File: /etc/php.ini
是的,还有错误,但它显示了正确的行号,而不是忽略注释行。重新启动 apache 时,我在 apache/error_log 中也收到了相同的错误消息。
PHP: syntax error, unexpected '(' in /etc/php.ini on line 16
php 文件有效,但没有将有关 ini 的错误发送到日志。
那么,你为什么不编辑你的 /etc/php5/apache2/php.ini 呢?只需擦除几行,看看错误消息是否移动到不同的数字。
确保更改后重新启动apache。