-2

for about a day I'm trying to find a way to see php logs on a server by godaddy where wordpress is hosted. I can ssh to the server, but I'm not able to edit the php.ini because it's readonly. I've read that it would be possible to add a custom php.ini to change some settings. I've put one in the public folder where the wordpress site is located and added the line:

error_log = "/php_error.log"

In the same folder I've created the file php_error.log and set the following permissions:

-rw-rw----

As this seemed not to work, I've tried an approach editing the .htaccess file.

# log php errors
php_flag display_startup_errors off
php_flag display_errors off
php_flag html_errors off
php_flag  log_errors on
php_value error_log /php_error.log

Still I don't see any errors in the file. Is it a problem of the permissions of the error file or should the path be different e.g. html/php_error.log ?

Mindful
  • 15
  • 1
  • 5
  • 2
    Why don't you just ask godaddy support where to find the error log file? – ADyson Nov 21 '22 at 17:51
  • Looks like this could be your file path. You are setting it to `/php_error.log` so this would be in the root directory of the server. If you can ssh into the server you can find the working directory using the `pwd` command. Use that output as the folder directory for you error log. If this does not help you may need to chat to GoDaddy. Good luck! – andrew hutchings Nov 21 '22 at 17:57
  • I've called them already before asking the question here. They've sent me two articles which should help me getting the logs, but so far I'm still failing. pwd was a good hint, however I've tried all variations of the path and it didn't achieve to see any logs. – Mindful Nov 21 '22 at 20:21

1 Answers1

1

I've finally found a solution. I have to create a .user.ini file to set custom settings of php.ini. I've put the file in the root of my public website directory and inserted the following line:

error_log = "/var/www/php_error.log"

It took me quite a while to figure out what the expected path to my log file is. Hopefully this will save some other people a lot of time and headache.

Mindful
  • 15
  • 1
  • 5