Apache: Logging 500 errors from joomla, php and php-fpm

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:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code> 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
</code>
<code> 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 </code>
  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:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code> 13.59.58.209 - - [20/Sep/2024:06:40:35 -0400] "GET /advisories HTTP/1.1" 500 481
r:"https://example.com/advisories/red-hat" "Mozilla/5.0 AppleWebKit/537.36 (KHTML,
like Gecko; compatible; ClaudeBot/1.0; [email protected])"
</code>
<code> 13.59.58.209 - - [20/Sep/2024:06:40:35 -0400] "GET /advisories HTTP/1.1" 500 481 r:"https://example.com/advisories/red-hat" "Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; [email protected])" </code>
  13.59.58.209 - - [20/Sep/2024:06:40:35 -0400] "GET /advisories HTTP/1.1" 500 481 
  r:"https://example.com/advisories/red-hat" "Mozilla/5.0 AppleWebKit/537.36 (KHTML,
  like Gecko; compatible; ClaudeBot/1.0; [email protected])"

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:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code> [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/html/plugins/system/autotweetcontent/autotweetcontent.php on line 86'
</code>
<code> [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/html/plugins/system/autotweetcontent/autotweetcontent.php on line 86' </code>
  [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/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:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code> [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/html/libraries/joomla
</code>
<code> [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/html/libraries/joomla </code>
  [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/html/libraries/joomla

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

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code> [22-Sep-2024 13:16:34] WARNING: [pool example] child 2215306, script
'/var/www/www.example.com/html/index.php' (request: "POST /index.php") executing
too slow (4.913751 sec), logging
</code>
<code> [22-Sep-2024 13:16:34] WARNING: [pool example] child 2215306, script '/var/www/www.example.com/html/index.php' (request: "POST /index.php") executing too slow (4.913751 sec), logging </code>
  [22-Sep-2024 13:16:34] WARNING: [pool example] child 2215306, script 
  '/var/www/www.example.com/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:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code> [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/html/plugins/system/cleantalkantispam/lib/Cleantalk/Common/Http/Request.php:216
</code>
<code> [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/html/plugins/system/cleantalkantispam/lib/Cleantalk/Common/Http/Request.php:216 </code>
  [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/html/plugins/system/cleantalkantispam/lib/Cleantalk/Common/Http/Request.php:216

but there isn’t always a direct enough 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.

2

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật