Jump to content

Joomla and apache/php/php-fpm logging


Recommended Posts

I have a joomla-4.4.8 website with apache 2.4.62 on fedora40 with php-8.3.11 and having some difficulty with logging. This is on my own server, so no cpanel or dashboard. On occasion, I see  500 errors in the apache access logs, but nothing to indicate what caused it or what the specific error was. I'd like to have more detailed information on what caused the 500 error written to a log file.

I'm a Linux admin and not familiar enough with PHP and logging to figure this out. I'd like to modify php.ini to log more information about apache 500 errors, and more specifically those caused by joomla. Here's what I have so far:

display_errors = Off
html_errors = On
display_startup_errors = On
log_errors = On
output_buffering = Off 
error_reporting = E_ALL
error_log = /var/log/php_errors.log
expose_php = Off

These are stored in a 90-php.ini file in /etc/php.d file on fedora40, designed to overwrite any older values that may be different. I've also checked them with phpinfo() locally. What is cpanel doing that has it show the line numbers involved in its main error file?

Here's an example from my apache access log for this domain showing a typical 500 error:

216.83.36.216 - - [21/Sep/2024:11:58:08 -0400] "POST /FCKeditor/editor/filemanager/connectors/asp/connector.asp?Command=FileUpload&Type=File&CurrentFolder=%2F HTTP/1.1" 500 540 r:"https://example.com/FCKeditor/editor/filemanager/connectors/asp/connector.asp?Command=FileUpload&Type=File&CurrentFolder=%2F" "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_8; nl-nl) AppleWebKit/531.22.7 (KHTML, like Gecko) Version/4.0.5 Safari/531.22.7"

Occasionally, we come across a 500 error when browsing the site ourselves, and it does display the error in the browser, but obviously that's always helpful and also doesn't always show the line number where the error occurred.

Some PHP errors go to the apache error_log, based on my apache settings. For example:

[Thu Sep 19 11:00:46.720026 2024] [proxy_fcgi:error] [pid 863110:tid 863147] [client 40.77.167.65:0] AH01071: Got error 'PHP message: PHP Deprecated:  strip_tags(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/www.example.com-443/html/plugins/system/autotweetcontent/autotweetcontent.php on line 86'

I'm also seeing mod_security errors being logged to the apache error_log, as they should. For example:

[Sun Sep 22 13:05:39.035262 2024] [authz_core:error] [pid 2410993:tid 2411038] [client 143.198.222.185:0] AH01630: client denied by server configuration: /var/www/www.example.com-443/html/libraries/joomla

The php-fpm log is mostly filled with slow log entries like this:

[22-Sep-2024 13:16:34] WARNING: [pool example] child 2215306, script '/var/www/www.example.com-443/html/index.php' (request: "POST /index.php") executing too slow (4.913751 sec), logging

The corresponding slow log for this domain shows the stack trace:

[22-Sep-2024 13:26:15]  [pool example] pid 2194046
script_filename = /var/www/www.example.com-443/html/index.php
[0x00007fd1d9213db0] curl_exec() /var/www/www.example.com-443/html/plugins/system/cleantalkantispam/lib/Cleantalk/Common/Http/Request.php:216
...

but there isn't always a direct enough of a correlation to the page, particularly when this is the index page and it doesn't always exceed the timeout period.

The php_error.log file also rarely shows any useful information.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.