PHP GoDaddy VPS Not Error Reporting - php

BEFORE YOU MARK THIS A DUPLICATE READ PLEASE
I've read dozens of threads both on this site and other with possible solutions to my problem however none have helped.
I switched to a GoDaddy VPS and I cannot get php to log errors what so ever. I went to their chat support and they basically told me I was on my own. My current php.ini settings below.
error_reporting = E_ALL
display_startup_errors = On
log_errors = On
track_errors = On
error_log = error_log
display_errors = On
Current php version I have installed php 7.0 and the extensions that are installed below. (Not sure if this info is beneficial)
php70-libc-client I
php70-pear
php70-php-bcmath
php70-php-calendar
php70-php-cli
php70-php-ftp
php70-php-fpm
php70-php-devel
php70-php-curl
php70-php-common
php70-php-gd
php70-php-imap
php70-php-mcrypt
php70-php-mysqlnd
php70-php-pdo
php70-php-posix
php70-runtime
php70-php-xml
php70-php-sockets
More Information (might be useful)
- I restarted my server multiple times.
- Using mysqli as data storage.
Error Logs That Exist
- /usr/local/cpanel/logs/error_log /usr/local/apache.ea3/logs/error_log
- /opt/cpanel/ea-php70/root/usr/share/pear/error_log
- /var/installatron/logs/error_log /var/log/httpd/error_log
- /var/log/apache2/error_log /home/server1/public_html/css/error_log
- /home/server1/public_html/php/error_log
- /home/server1/public_html/contact/error_log /home/server1/.trash/error_log
- /home/server2/public_html/error_log /home/server2/public_html/php/error_log
- /home/server2/public_html/faq/error_log
which one would be the main one?
With the help of Max (below) I found some error logs.
[Tue Nov 29 14:58:23.876535 2016] [:notice] [pid 1072] ModSecurity: APR compile$
[Tue Nov 29 14:58:23.876543 2016] [:notice] [pid 1072] ModSecurity: PCRE compil$
[Tue Nov 29 14:58:23.876548 2016] [:notice] [pid 1072] ModSecurity: LUA compile$
[Tue Nov 29 14:58:23.876552 2016] [:notice] [pid 1072] ModSecurity: LIBXML comp$
[Tue Nov 29 14:58:23.876555 2016] [:notice] [pid 1072] ModSecurity: Status engi$
[Tue Nov 29 14:58:23.901172 2016] [ssl:warn] [pid 1073] AH01909: s104-238-126-2$
[Tue Nov 29 14:58:23.902445 2016] [:notice] [pid 1073] mod_ruid2/0.9.8 enabled
[Tue Nov 29 14:58:23.905483 2016] [mpm_prefork:notice] [pid 1073] AH00163: Apac$
[Tue Nov 29 14:58:23.905502 2016] [core:notice] [pid 1073] AH00094: Command lin$
(XID sda356) Database Connect Error: Access denied for user 'leechprotect'#'localhost' (using password: YES)

Related

PHP stops serving requests after awhile and returns errors 502 - 504

I currently have a Amazon EC2 instance (t3.small) running Apache and PHP 7.2 which serves a Laravel application.
After running for awhile, php will stop responding to requests (apache still receives them and forwards them to php, verified this using apachetop to see incoming requests). In Apache, there will errors such as follows and returns errors 502-504 and takes very long to recover until restarted. Here are some logs which might help find the issue.
[Wed Jan 20 05:25:57.287493 2021] [proxy_fcgi:error] [pid 2517:tid 140104425260800] (104)Connection reset by peer: [client 172.31.40.9:6946] AH01075: Error dispatching request to : , referer: https://mysite
[Wed Jan 20 05:25:59.608161 2021] [suexec:notice] [pid 3853:tid 139828464464448] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Wed Jan 20 05:25:59.627458 2021] [so:warn] [pid 3853:tid 139828464464448] AH01574: module headers_module is already loaded, skipping
[Wed Jan 20 05:25:59.627877 2021] [so:warn] [pid 3853:tid 139828464464448] AH01574: module cgid_module is already loaded, skipping
[Wed Jan 20 05:25:59.633440 2021] [mpm_event:warn] [pid 3853:tid 139828464464448] AH00514: MaxRequestWorkers of 404 is not an integer multiple of ThreadsPerChild of 25, decreasing to nearest multiple 400
[Wed Jan 20 05:25:59.636514 2021] [lbmethod_heartbeat:notice] [pid 3853:tid 139828464464448] AH02282: No slotmem from mod_heartmonitor
[Wed Jan 20 05:25:59.648040 2021] [mpm_event:notice] [pid 3853:tid 139828464464448] AH00489: Apache/2.4.46 () OpenSSL/1.0.2k-fips configured -- resuming normal operations
[Wed Jan 20 05:25:59.648081 2021] [core:notice] [pid 3853:tid 139828464464448] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'
[Wed Jan 20 05:28:48.232549 2021] [proxy:error] [pid 3897:tid 139827752199936] (111)Connection refused: AH02454: FCGI: attempt to connect to Unix domain socket /run/php-fpm/www.sock (*) failed
[Wed Jan 20 05:28:48.232596 2021] [proxy_fcgi:error] [pid 3897:tid 139827752199936] [client 172.31.40.9:8904] AH01079: failed to make connection to backend: httpd-UDS, referer: https://mysite
[Wed Jan 20 05:28:48.243356 2021] [proxy:error] [pid 4144:tid 139827743807232] (2)No such file or directory: AH02454: FCGI: attempt to connect to Unix domain socket /run/php-fpm/www.sock (*) failed
[Wed Jan 20 05:28:48.243356 2021] [proxy:error] [pid 4144:tid 139826972038912] (2)No such file or directory: AH02454: FCGI: attempt to connect to Unix domain socket /run/php-fpm/www.sock (*) failed
[Wed Jan 20 06:46:28.744679 2021] [proxy_fcgi:error] [pid 6584:tid 139720269829888] [client 172.31.40.9:14942] AH01067: Failed to read FastCGI header, referer: https://mysite
[Wed Jan 20 06:46:28.744687 2021] [proxy_fcgi:error] [pid 6584:tid 139720269829888] (104)Connection reset by peer: [client 172.31.40.9:14942] AH01075: Error dispatching request to : , referer: https://mysite
[Wed Jan 20 06:46:31.657254 2021] [mpm_event:notice] [pid 6559:tid 139720919990848] AH00492: caught SIGWINCH, shutting down gracefully
[Wed Jan 20 06:46:32.729979 2021] [suexec:notice] [pid 6937:tid 140554580320832] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
But, by having a cron job that runs php artisan schedule:run every minute, this behavior of not 'serving any request' will not occur.
So, I'm wondering if it is a configuration issue or is it something else?

Apache2 Restarting every 1min and 3 seconds - Ubuntu 16.04

It's pretty much in the title. I've tried everything I can think of but Apache2 is doing a restart every 1min and 3seconds - without fail. It's not doing a graceful restart, as every time it restarts the client can not connect, and are met with "This site can't be reached" in Chrome.
This is happening on a VPS hosted on Linode with the Ubuntu 16.04 image. As far as I know everything was setup as default. (I inherited the site, but trying to figure out this odd issue. )
Apache is version 2.4.18.
PHP is version 7.0.30
The site does not see a lot of traffic (maybe 1k hits/month) - so traffic should not be causing this either.
Below are the logs that I'm seeing from the Apache2 error.log
[Mon Aug 27 23:04:56.015029 2018] [core:notice] [pid 32672] AH00094: Command line: '/usr/sbin/apache2'
[Mon Aug 27 23:05:56.492903 2018] [mpm_prefork:notice] [pid 32672] AH00169: caught SIGTERM, shutting down
[Mon Aug 27 23:05:58.000463 2018] [:notice] [pid 32730] ModSecurity for Apache/2.9.0 (http://www.modsecurity.org/) configured.
[Mon Aug 27 23:05:58.001156 2018] [:notice] [pid 32730] ModSecurity: APR compiled version="1.5.1"; loaded version="1.5.2"
[Mon Aug 27 23:05:58.001857 2018] [:warn] [pid 32730] ModSecurity: Loaded APR do not match with compiled!
[Mon Aug 27 23:05:58.001959 2018] [:notice] [pid 32730] ModSecurity: PCRE compiled version="8.35 "; loaded version="8.38 2015-11-23"
[Mon Aug 27 23:05:58.002041 2018] [:warn] [pid 32730] ModSecurity: Loaded PCRE do not match with compiled!
[Mon Aug 27 23:05:58.002155 2018] [:notice] [pid 32730] ModSecurity: LUA compiled version="Lua 5.1"
[Mon Aug 27 23:05:58.002230 2018] [:notice] [pid 32730] ModSecurity: YAJL compiled version="2.1.0"
[Mon Aug 27 23:05:58.002300 2018] [:notice] [pid 32730] ModSecurity: LIBXML compiled version="2.9.2"
[Mon Aug 27 23:05:58.002460 2018] [:notice] [pid 32730] ModSecurity: StatusEngine call: "2.9.0,Apache/2.4.18 (Ubuntu),1.5.1/1.5.2,8.35/8.38 2015-11-23,Lua 5.1,2.9.2,<removed_for_SO>"
[Mon Aug 27 23:05:58.060493 2018] [:notice] [pid 32730] ModSecurity: StatusEngine call successfully sent. For more information visit: http://status.modsecurity.org/
[Mon Aug 27 23:05:58.105989 2018] [:notice] [pid 32734] FastCGI: process manager initialized (pid 32734)
[Mon Aug 27 23:05:59.016019 2018] [mpm_prefork:notice] [pid 32731] AH00163: Apache/2.4.18 (Ubuntu) mod_fastcgi/mod_fastcgi-SNAP-0910052141 OpenSSL/1.0.2g configured -- resuming normal operations
[Mon Aug 27 23:05:59.017563 2018] [core:notice] [pid 32731] AH00094: Command line: '/usr/sbin/apache2'
[Mon Aug 27 23:06:59.489457 2018] [mpm_prefork:notice] [pid 32731] AH00169: caught SIGTERM, shutting down
I see the issues with APR and PCRE not having the same version, but I had read in a different thread that this should not be causing the issue I am seeing.
If there is anything else I can setup to help figure this out - that would be appreciated, or if someone else has run across something similar that would be helpful too.
I've already tried looking at HTOP to see what processes are running - nothing out of the ordinary there, I do see a CPU spike AFTER I see the restart command (Which makes sense given apache is restarting)
We do have logrotate installed (another common thing I have seen) however logrotate is set to run weekly, so I don't think that its causing this either.
We're hosting wordpress on the site as well.
Let me know if there is anything else I can add to this that might help.
EDIT: Checked on cronjobs as well - no cronjobs

Why is my Apache2 .htaccess file CORS header causing a 500 internal server error?

I am attempting to enable CORS access to a directory on my Apache2 web server. I enabled .htaccess file and added a line which is meant to enable CORS access to the directory.
Header set Access-Control-Allow-Origin: "*"
After saving the .htaccess file with that line, I get a 500 internal server error when attempting to access the directory (http://williamgreen.hopto.org/audio/).
Any ideas? Is my header incorrect?
Thank you.
Apache2 error.log:
[Thu Mar 09 15:02:15.118686 2017] [mpm_event:notice] [pid 2668:tid 547718139904] AH00489: Apache/2.4.18 (Ubuntu) configured -- resuming normal operations
[Thu Mar 09 15:02:15.119080 2017] [core:notice] [pid 2668:tid 547718139904] AH00094: Command line: '/usr/sbin/apache2'
[Thu Mar 09 19:27:09.148771 2017] [mpm_event:notice] [pid 2668:tid 547718139904] AH00491: caught SIGTERM, shutting down
[Thu Mar 09 19:27:10.339942 2017] [mpm_event:notice] [pid 14385:tid 548172222464] AH00489: Apache/2.4.18 (Ubuntu) configured -- resuming normal operations
[Thu Mar 09 19:27:10.340300 2017] [core:notice] [pid 14385:tid 548172222464] AH00094: Command line: '/usr/sbin/apache2'
[Thu Mar 09 19:39:47.583449 2017] [mpm_event:notice] [pid 14385:tid 548172222464] AH00491: caught SIGTERM, shutting down
[Thu Mar 09 19:39:47.776394 2017] [mpm_event:notice] [pid 14915:tid 548543827968] AH00489: Apache/2.4.18 (Ubuntu) configured -- resuming normal operations
[Thu Mar 09 19:39:47.776776 2017] [core:notice] [pid 14915:tid 548543827968] AH00094: Command line: '/usr/sbin/apache2'
[Thu Mar 09 19:39:51.201462 2017] [core:alert] [pid 14919:tid 548512096688] [client 73.15.129.28:57278] /var/www/html/audio/.htaccess: Invalid command 'Header', perhaps misspelled or defined by a module not included in the server configuration, referer: http://williamgreen.hopto.org/audio/Music/
[Thu Mar 09 19:39:51.204818 2017] [core:alert] [pid 14918:tid 548528873904] [client 73.15.129.28:57280] /var/www/html/audio/.htaccess: Invalid command 'Header', perhaps misspelled or defined by a module not included in the server configuration, referer: http://williamgreen.hopto.org/audio/Music/
[Thu Mar 09 19:39:55.389791 2017] [core:alert] [pid 14918:tid 548520485296] [client 73.15.129.28:57279] /var/www/html/audio/.htaccess: Invalid command 'Header', perhaps misspelled or defined by a module not included in the server configuration
[Thu Mar 09 19:40:02.264113 2017] [core:alert] [pid 14918:tid 548512096688] [client 73.15.129.28:57283] /var/www/html/audio/.htaccess: Invalid command 'Header', perhaps misspelled or defined by a module not included in the server configuration
[Thu Mar 09 19:40:03.735693 2017] [core:alert] [pid 14919:tid 548503708080] [client 73.15.129.28:57284] /var/www/html/audio/.htaccess: Invalid command 'Header', perhaps misspelled or defined by a module not included in the server configuration
[Thu Mar 09 19:40:04.183378 2017] [core:alert] [pid 14918:tid 548503708080] [client 73.15.129.28:57285] /var/www/html/audio/.htaccess: Invalid command 'Header', perhaps misspelled or defined by a module not included in the server configuration
[Thu Mar 09 19:40:04.527274 2017] [core:alert] [pid 14919:tid 548520485296] [client 73.15.129.28:57286] /var/www/html/audio/.htaccess: Invalid command 'Header', perhaps misspelled or defined by a module not included in the server configuration
[Thu Mar 09 19:40:04.846900 2017] [core:alert] [pid 14919:tid 548495319472] [client 73.15.129.28:57287] /var/www/html/audio/.htaccess: Invalid command 'Header', perhaps misspelled or defined by a module not included in the server configuration
You dont have the headers module installed.
With apache2, just run a2enmod headers and then sudo service apache2 restart and it will install the headers module automatically.

httpd on AWS suddenly stopped working after I set an A record

So today, I was trying to do two things: get rid of extensions like .php in my domains, and use an A record to point a subdomain I have to the IP of the server on which the site I am developing is running on.
I did both at the same time, then restarted httpd, but when it came back up - I couldn't access the website at all. httpd claims it is running fine. I decided to remove the rewrite rules to see if I had somehow introduced a bug into httpd.conf, but after another restart, it still didn't serve webpages. I tried restarting the server instance - no luck again.
I hadn't changed anything else and the server was serving webpages fine before this. I am trying to access the page using just the IP address, so I don't think the A record could have made a difference either.
The output in httpd's error log is the following:
[Wed Aug 10 16:39:44.263098 2016] [suexec:notice] [pid 1843] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain. Set the 'ServerName' directive globally to suppress this message
[Wed Aug 10 16:39:44.308130 2016] [auth_digest:notice] [pid 1843] AH01757: generating secret for digest authentication ...
[Wed Aug 10 16:39:44.308701 2016] [lbmethod_heartbeat:notice] [pid 1843] AH02282: No slotmem from mod_heartmonitor
[Wed Aug 10 16:39:44.662464 2016] [mpm_prefork:notice] [pid 1843] AH00163: Apache/2.4.18 (Amazon) configured -- resuming normal operations
[Wed Aug 10 16:39:44.662486 2016] [core:notice] [pid 1843] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'
[Wed Aug 10 16:40:02.960708 2016] [mpm_prefork:notice] [pid 1843] AH00171: Graceful restart requested, doing restart
[Wed Aug 10 16:40:03.042697 2016] [auth_digest:notice] [pid 1843] AH01757: generating secret for digest authentication ...
[Wed Aug 10 16:40:03.043290 2016] [lbmethod_heartbeat:notice] [pid 1843] AH02282: No slotmem from mod_heartmonitor
[Wed Aug 10 16:40:03.105719 2016] [mpm_prefork:notice] [pid 1843] AH00163: Apache/2.4.18 (Amazon) configured -- resuming normal operations
[Wed Aug 10 16:40:03.105729 2016] [core:notice] [pid 1843] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'
[Wed Aug 10 16:40:03.105750 2016] [mpm_prefork:warn] [pid 1843] AH00167: long lost child came home! (pid 1968)
Any help?
Edit: I used dig on the domain that I pointed with the A-record, and it resolves to the IP (which currently times out but is otherwise the right IP). So it seemingly isn't an issue there, either. I can connect to the server with SSH fine.

Getting Blank screen and nothing in logs. Is this Php syntax and Apache issue?

I am getting the blank screen. No errors in the Apache logs, nothing.
I was thinking there may be a php syntax error and it quietly dies, but I have configured php.ini to display errors:
display_errors=On
html_errors=On
error_reporting=E_ALL | E_STRICT
display_startup_errors=On
here are relevant php configurations loaded:
display_errors On On
display_startup_errors On
enable_dl Off Off
enable_post_data_reading On On
error_append_string no value no value
error_log no value no value
error_prepend_string no value no value
error_reporting 22527
Why is there no Apache error logs? How to trace Apache execution? any help is much appreciated. Thank you
Update:
I was wrong, Apache writes log only once on restart at the time of restart at the location specified by ErrorLog in the Apache Configuration, but nothing is written afterwards even when I get the blank site. Here logs from ErrorLog:
[Tue Nov 18 17:08:20.372970 2014] [mpm_prefork:notice] [pid 1601] AH00163: Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.4 configured -- resuming normal operations
[Tue Nov 18 17:08:20.376988 2014] [mpm_prefork:info] [pid 1601] AH00164: Server built: Jul 22 2014 14:36:39
[Tue Nov 18 17:08:20.377699 2014] [core:notice] [pid 1601] AH00094: Command line: '/usr/sbin/apache2'
[Tue Nov 18 17:19:32.301203 2014] [mpm_prefork:notice] [pid 1643] AH00163: Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.4 configured -- resuming normal operations
[Tue Nov 18 17:19:32.313839 2014] [mpm_prefork:info] [pid 1643] AH00164: Server built: Jul 22 2014 14:36:39
[Tue Nov 18 17:19:32.314481 2014] [core:notice] [pid 1643] AH00094: Command line: '/usr/sbin/apache2'
[Tue Nov 18 17:50:22.848631 2014] [core:info] [pid 1643] AH00096: removed PID file /var/run/apache2/apache2.pid (pid=1643)
[Tue Nov 18 17:50:22.848631 2014] [mpm_prefork:notice] [pid 1643] AH00169: caught SIGTERM, shutting down
[Tue Nov 18 17:50:25.288368 2014] [mpm_prefork:notice] [pid 3313] AH00163: Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.4 configured -- resuming normal operations
[Tue Nov 18 17:50:25.290696 2014] [mpm_prefork:info] [pid 3313] AH00164: Server built: Jul 22 2014 14:36:39
[Tue Nov 18 17:50:25.291613 2014] [core:notice] [pid 3313] AH00094: Command line: '/usr/sbin/apache2'
How to make Apache log for PHP errors or anything for that matter to be able troubleshoot issues?
It turns out this was neither Apache nor PHP error, but an application level issue where there is ErrorHandler function declared that does hide all the php errors as described here:
PHP's white screen of death
I came to conclusion to the fact that it is neither Apache nor PHP configurations by changing ErrorLevel to trace8 in virtual host settings:
LogLevel trace8
ErrorLog ${APACHE_LOG_DIR}/dev-virtual/error.log
Afterwards, I tail the logs specified in ErrorLog from command line and make requests. The logs showed:
[Tue Nov 18 18:16:37.398720 2014] [http:trace3] [pid 4054] http_filters.c(977): [client 10.88.12.0:49378] Response sent with status 200, headers:
...
[Tue Nov 18 18:16:37.399243 2014] [http:trace4] [pid 4054] http_filters.c(806): [client 10.88.12.0:49378] Content-Length: 0
...
Here, the logs shows 200 response with Content-Length:0. The 200 is good response from Apache, so its not Apache error responsible for the blank page. Seeing the Content-Lenght set to 0, made me think there is something more than PHP setup/configuration issue. It was the ErrorHandler at the Application level.

Categories