PHP Display Errors on Command Line
When i run PHP script from command line, it won't display any errors.
Content of the file is
# php test.php
#
Content of the file is
# cat test.php
PHP Settings and Version
# php -i | grep error
display_errors => STDOUT => STDOUT
display_startup_errors => Off => Off
error_append_string => no value => no value
error_log => error_log => error_log
error_prepend_string => no value => no value
error_reporting => 81 => 81
html_errors => Off => Off
ignore_repeated_errors => Off => Off
log_errors => On => On
log_errors_max_len => 1024 => 1024
track_errors => Off => Off
xmlrpc_error_number => 0 => 0
xmlrpc_errors => Off => Off
# php -v
PHP 5.3.29 (cli) (built: May 31 2015 06:29:44)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2014 Zend Technologies
with the ionCube PHP Loader v4.7.5, Copyright (c) 2002-2014, by ionCube Ltd., and
with Zend Guard Loader v3.3, Copyright (c) 1998-2010, by Zend Technologies
#
There i is no error_log on current folder.
# ls -l | grep err
#
If i add fix PHP script by adding semicoln (;), it works properly.
I want to debug a script as it works locally, not on server.
Any idea how i can get php scripts to display errors in terminal ?-
Hello :) Are you running the PHP command as "root" or an individual users? Does it work if you use the command with the "-d" flag? EX: php -d display_errors /path/to/file.php
Thank you.0 -
Running as root as i am making a script that alert me when some one login to cpanel. I got it working with php -n option (no php.ini) root@server74 [~]# php -d display_errors 1.php root@server74 [~]# php -d display_errors=on 1.php root@server74 [~]# cat 1.php0 -
New Running as root as i am making a script that alert me when some one login to cpanel.
I am happy to see you were able to address the issue. One feature that might interest you is the ability for users can enable login notifications in the "Contact Information" area inside of cPanel. Thank you.0 -
I am happy to see you were able to address the issue. One feature that might interest you is the ability for users can enable login notifications in the "Contact Information" area inside of cPanel. Thank you.
Thanks, i never know this is possible. Is there anyway root can enable this for all users by default ? Also enforce a password policy, so passwords get changed. Many (including me) never changed passwords. Having to change password changed every 60 days like banks will keep the internet as a whole safe :)0 -
Hello :) 1. There are no options to enable this for all accounts, but the setting is stored in "/home/$username/.cpanel/contactinfo" as the following entry when enabled: "notify_account_login": 1
Thus, you could develop a custom code that adds or modifies this entry in the same file for each account. 2. We do have a password aging feature that's documented at:0
Please sign in to leave a comment.
Comments
5 comments