How to access php error log

Status
Not open for further replies.

sperko

Member
Messages
258
Reaction score
4
Points
18
Do free hosting accounts get access to the php error logs?

If they do, how do I access them?

Thank you
 
Last edited:

sperko

Member
Messages
258
Reaction score
4
Points
18
how do I view the php error log in the file manager?
 
Last edited:

caftpx10

Well-Known Member
Messages
1,534
Reaction score
114
Points
63
A very important thing I should point out is that display_errors SHOULD be disabled for production for security purposes. It's good for a quick look at for errors when testing but you wouldn't want users to see the information that it would put out.

In cPanel x3, go to Select PHP Version > Switch to PHP Settings
Do the following changes to the listed directives/options:
display_errors = Off
log_errors = On

After that press 'save'. Next time when an error/warning/notice/whatever occurs, it won't appear in the browser but it will be logged in 'error.log' files.
Note that these files will be created where the code execution occurs. So if /blah.php gets an error then it would be in /error.log and if /fruit/lemon.php gets an error then it would be /fruit/error.log

You can access these files via file manager or via FTP by opening them as if you're editing code in a file.


What I should also point out is that you should deny access to the file error.log to everyone so that they can't read it unless they have other forms of access such as FTP. I don't know if the file manager would be affected but it's worth trying.
 

sperko

Member
Messages
258
Reaction score
4
Points
18
I think that's exactly what I was looking for

thanks for the great answer!
 
Last edited:
Status
Not open for further replies.
Top