Bravo List
Register
Go Back   > Bravo List > P2P > Forum > Tutorials
Reply
  #1  
Old 27th April 2016, 15:57
Phogo's Avatar
Phogo Phogo is offline
VIP
 
Join Date: Jan 2008
United Kingdom
Posts: 902
Default PHP Error logging
Find out path to php.ini

The default paths are as follows for popular unix like system:
  • CentOS Linux/RHEL v5.x/6.x/7.x : /etc/php.ini
  • Ubuntu / Debian Linux (PHP 7 fpm) : /etc/php/7.0/fpm/php.ini
  • Ubuntu / Debian Linux (PHP 5.6 fpm) : /etc/php/5.6/fpm/php.ini
  • Ubuntu / Debian Linux (PHP 7 with Apache 2) : /etc/php/5.6/apache2/php.ini
  • Ubuntu / Debian Linux (PHP 5.6 with Apache 2) : /etc/php/7/apache2/php.ini
  • FreeBSD unix server v9.x/10.x+: /usr/local/etc/php.ini
You can use the following command to find out path to php.ini:
# php5-cgi -i | grep php.ini

How do I log all php errors to a log fiie?

Just add following line to /etc/php.ini to log errors to specified file, say /var/log/php-scripts.log or /var/log/httpd/php-error.log:
# vi /etc/php.ini

Find and modify the error_log directive as follows:
error_log = /var/log/php-scripts.log

Make sure display_errors set to Off (no errors to end users):
display_errors = Off
Save and close the file.

Restart web server or php7-fpm service:
# /etc/init.d/httpd restart
OR
# systemctl restart httpd.service
OR
# restart php7.0-fpm

How do I see logs?

Login using ssh or download a log file /var/log/php-scripts.log using sftp client:
$ sudo tail -f /var/log/php-scripts.log

Shamelessly stolen from cyberciti.biz


With .htaccess file

# enable PHP error logging
php_value error_reporting VALUE
php_flag log_errors on
php_value error_log FULL/PATH/php_error_your_domain.log

VALUE
The value used defines the level or error reporting you require, for example:
  • -1 = ALL errors, not recommended but can be useful when used sparingly.
  • 30719 = Same as E_ALL, less info than -1
  • 30711 = E_ALL but not E_NOTICE
  • 30709 = E_ALL but not E_NOTICE or E_WARNING
  • 22517 = E_ALL but not E_NOTICE or E_WARNING or E_DEPRECATED
Create the php_error_your_domain.log file.

Shamelessly stolen from here
Reply With Quote
  #2  
Old 21st March 2019, 11:19
Henrysix Henrysix is offline
Member
 
Join Date: Feb 2019
Sri Lanka
Posts: 11
Default PHP Error logging
Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /home/user/domain/rss.php on line 27

Line 27: itemsvalue = node->getElementsByTagNamevalue->item0->nodeValue;

Using as default retrieving rss from p2l.
Reply With Quote
Reply

Tags
error , logging , php

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



All times are GMT +2. The time now is 21:16. vBulletin skin by ForumMonkeys. Powered by vBulletin® Version 3.8.11 Beta 3
Copyright ©2000 - 2024, vBulletin Solutions Inc.