有時如果要將 PHP 的 Error Log 另外輸出成一個檔...可以這樣做
- Login to the web server, and edit the php.ini file with any editor such as vi.Note: php.ini configuration file can be found at /etc/php.ini or /usr/local/lib/php.ini.
- Locate display_errors directive, and change its value to Off so that the line looks like following (if not found, add in the line) to disable error output to web pages:display_errors = Off
- Locate log_errors directive, and change its value to On so that the line looks like following (if not found, add in the line) to enable error logging to file:log_errors = On
- Locate error_log directive, and modify its value to a preferred file name to save the error log file so that the line looks like following (if not found, add in the line):error_log = error_log
Note: Path can be included, for example, error_log = /var/log/error_log. If no path is specified, the error log file may be stored at the same directory where PHP scripts are located.
- Save the modified php.ini.
- Restart the web server. For example, Apache web server restarting command is: # /etc/init.d/httpd restart
檢查看看有沒有輸出囉~~
tail -f /path/to/error_log