Author Topic: Apache won't start after upgrading to php 8+ (httpd failed)  (Read 3433 times)

0 Members and 1 Guest are viewing this topic.

Offline
*
Apache won't start after upgrading to php 8+ (httpd failed)
« on: August 30, 2023, 05:05:28 PM »
Hi,

I am having this issue again, after updating the server PHP version to PHP 8.0.2
Any version of PHP 8+ is causing Apache not to start up, so websites are unreachable.

Tried switching back to 7.4.3 which all the sites usually work with, but not this time.
This has to be a bug, because I had the same issue when upgrading to php 7+

I forget how we resolved it last time.

The data-center also checked and couldn't resolve the issue,
They said the issue is in CWP

user@svr1.web.it ~$ systemctl status httpd -l
● httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Wed 2023-08-30 18:06:37 IST; 1min 53s ago
     Docs: man:httpd(8)
           man:apachectl(8)
  Process: 18391 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
 Main PID: 18391 (code=exited, status=1/FAILURE)
Aug 30 18:06:37 svr1.web.it systemd[1]: Starting The Apache HTTP Server...
Aug 30 18:06:37 svr1.web.it systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
Aug 30 18:06:37 svr1.web.it systemd[1]: Failed to start The Apache HTTP Server.
Aug 30 18:06:37 svr1.web.it systemd[1]: Unit httpd.service entered failed state.
Aug 30 18:06:37 svr1.web.it systemd[1]: httpd.service failed.


user@svr1.web.it ~$ service httpd restart
Redirecting to /bin/systemctl restart httpd.service
Job for httpd.service failed because the control process exited with error code. See "systemctl status httpd.service" and "journalctl -xe" for details.


I ran these commands in the SSH terminal

systemctl status httpd.service

journalctl -xe


--

user@svr1.web.it ~$ systemctl status httpd.service
● httpd.service - Web server Apache
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor
preset: disabled)
   Active: failed (Result: exit-code) since Tue 2023-08-29 22:50:58 IST; 7min
ago
  Process: 23749 ExecStart=/usr/local/apache/bin/apachectl start (code=exited,
status=139)
 Main PID: 7129 (code=killed, signal=SEGV)
Aug 29 22:50:58 svr1.web.it systemd[1]: Starting Web server Apache...
Aug 29 22:50:58 svr1.web.it apachectl[23749]:
/usr/local/apache/bin/apachectl: line 79: 23751 Segmentation fault      $HTTPD
-k $ARGV
Aug 29 22:50:58 svr1.web.it systemd[1]: httpd.service: control process
exited, code=exited status=139
Aug 29 22:50:58 svr1.web.it systemd[1]: Failed to start Web server
Apache.
Aug 29 22:50:58 svr1.web.it systemd[1]: Unit httpd.service entered
failed state.
Aug 29 22:50:58 svr1.web.it systemd[1]: httpd.service failed.


The info from journalctl -xe is a bit long to post here.

I'm also unable to update CWP again, it gives Ajax Error

Apaprently, some applications are working fine without Apache,
But all the websites are down.

I also tried switching from Apache Only to Nginx and some of the sites worked, not all.
I can't use any of the other servers in WebServers_manage, because the sites won't work.

I'd like to get everything working again with Nginx & Varnish & Apache, which offers the best performance.

Any advice appreciated.
« Last Edit: August 30, 2023, 05:25:06 PM by emar »

Offline
*
Re: Apache won't start after upgrading to php 8+ (httpd failed)
« Reply #1 on: September 03, 2023, 07:37:47 AM »
This is a nightmare to fix, several issues, dunno where to start.

CWP support checked the Apache issue, got nginx, vanish, apache, php-fpm running,
Unfortunately websites (wordpress) were still unreachable.

I tried switching php-fpm selector back to a version of php that all sites worked with (7.4)
Nothing worked, Apache was still down.

Now the server has nginx, apache, vanish, php-fpm selected.
When I visit any website I get Access Denied.

So I went back to the main CWP dashboard and set the web server back to Apache Only.

Apache appears offline so I click Start Apache but it doesn't restart.


I switched back to nginx, apache, vanish, php-fpm for now,
They all seem to be running in the dashboard, but none of the sites are accessible. Access Denied.

I'm trying everything, I even hit that Fix Permissions option,
But now every domain has Owner & Group set to nobody, for all files and folders.

Any advice appreciated.
« Last Edit: September 03, 2023, 07:54:19 AM by emar »

Offline
*****
Re: Apache won't start after upgrading to php 8+ (httpd failed)
« Reply #2 on: September 04, 2023, 02:58:02 AM »
Logs usually help unravel these types of problems. What do the apache logs show? Also, do an apache configtest to make sure your conf file syntax is correct.

Offline
*
Re: Apache won't start after upgrading to php 8+ (httpd failed)
« Reply #3 on: September 04, 2023, 05:13:05 AM »
Hi,

I ran /usr/local/apache/bin/apachectl configtest

Syntax OK

From: /usr/ local/apache/logs/error_log

[Mon Sep 04 05:20:45.445656 2023] [mpm_event:notice] [pid 23752:tid 140413806012288] AH00493: SIGUSR1 received.  Doing graceful restart
Failed loading /usr/local/ioncube/ioncube_loader_lin_8.1.so:  /usr/local/ioncube/ioncube_loader_lin_8.1.so: undefined symbol: file_globals
Failed loading /usr/local/ioncube/ioncube_loader_lin_8.1.so:  /usr/local/ioncube/ioncube_loader_lin_8.1.so: undefined symbol: file_globals
Failed loading /usr/local/ioncube/ioncube_loader_lin_8.1.so:  /usr/local/ioncube/ioncube_loader_lin_8.1.so: undefined symbol: file_globals
Failed loading /usr/local/ioncube/ioncube_loader_lin_8.1.so:  /usr/local/ioncube/ioncube_loader_lin_8.1.so: undefined symbol: file_globals
Failed loading /usr/local/ioncube/ioncube_loader_lin_8.1.so:  /usr/local/ioncube/ioncube_loader_lin_8.1.so: undefined symbol: file_globals
[Mon Sep 04 05:20:45.654488 2023] [ssl:warn] [pid 23752:tid 140413806012288] AH01873: Init: Session Cache is not configured [hint: SSLSessionCache]

[Mon Sep 04 05:20:45.665045 2023] [ssl:warn] [pid 23752:tid 140413806012288] AH01909: cpanel.site.biz:443:0 server certificate does NOT include an ID which matches the server name
[Mon Sep 04 05:20:45.665451 2023] [ssl:warn] [pid 23752:tid 140413806012288] AH01909: mail.site.biz:443:0 server certificate does NOT include an ID which matches the server name

From: /var/ log/httpd/error_log

[Thu Aug 31 20:49:05.761282 2023] [ssl:emerg] [pid 25913] AH02311: Fatal error initialising mod_ssl, exiting. See /etc/httpd/logs/ssl_error_log for more information
[Thu Aug 31 20:49:09.660173 2023] [suexec:notice] [pid 26142] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Thu Aug 31 20:49:09.660434 2023] [core:emerg] [pid 26142] (28)No space left on device: AH00023: Couldn't create the ssl-cache mutex
AH00016: Configuration Failed

--

So, I'm looking for /etc/httpd/logs/ssl_error_log
But all I can find is: etc/httpd_bak/logs, there's no /etc/httpd/

Is that another issue?

From: /etc/httpd_bak/logs/ssl_error_log

[Thu Aug 31 20:33:33.700527 2023] [ssl:emerg] [pid 20549] SSL Library Error: error:0B080074:x509 certificate routines:X509_check_private_key:key values mismatch
[Thu Aug 31 20:49:05.761231 2023] [ssl:warn] [pid 25913] AH01906: RSA server certificate is a CA certificate (BasicConstraints: CA == TRUE !?)
[Thu Aug 31 20:49:05.761243 2023] [ssl:warn] [pid 25913] AH01909: RSA certificate configured for svr1.site.it:443 does NOT include an ID which matches the server name
[Thu Aug 31 20:49:05.761254 2023] [ssl:emerg] [pid 25913] AH02238: Unable to configure RSA server private key
[Thu Aug 31 20:49:05.761273 2023] [ssl:emerg] [pid 25913] SSL Library Error: error:0B080074:x509 certificate routines:X509_check_private_key:key values mismatch


Have Web Server set to Nging, Apache, Vanish, PHP-FPM.
They all seem to be running fine from looking at the dashboard.

Have the server updated to latest version.
PHP version: 8.1.22 Forced PHP-FPM: 8.1

All websites are down.

Error 503 Backend fetch failed
Backend fetch failed

Guru Meditation:
XID: 196794

Varnish cache server

Also, I tried Fix Permissions under User Accounts,
Now all websites Owner & group are set to "nobody"
Do I need to fix those back to the right owners.
« Last Edit: September 04, 2023, 05:33:55 AM by emar »

Offline
*
Re: Apache won't start after upgrading to php 8+ (httpd failed)
« Reply #4 on: September 05, 2023, 04:09:13 PM »
I think we'll have to migrate to a new server manager.
I'm 100% sure this is not something I have caused.

Offline
*****
Re: Apache won't start after upgrading to php 8+ (httpd failed)
« Reply #5 on: September 05, 2023, 08:01:31 PM »
Your logs indicate an IonCube problem and an SSL server name mismatch. Can you work on those two problems and see if it starts? Did you follow up with support and let them know you made further changes from the state they left it and apache then wouldn't start?

Offline
*
Re: Apache won't start after upgrading to php 8+ (httpd failed)
« Reply #6 on: September 05, 2023, 08:30:14 PM »
I did go for one time support, they switched it to nginx, apache, vanish, php-fpm
But Apache won't start if I switch web servers back to Apache Only, not that I want to switch it back.
The sites were running fine on Apache Only and PHP 7.4, now they won't run with that version or any.

I have a few WordPress sites that were kicking up that they needed PHP 8.0 or 8.1 so I upgraded.
PHP 8.0 is no good because they skipped past PHP 8.0 with the new Ioncube.

I'd be happy to pay CWPto check it out, it's probably not a serious bug, I can't fix it quick enough.
Every time I upgrade php, or change web servers this happens.

I've only a couple of websites on the server and audio streaming application, with proxy to get secure https urls.
The streaming server is running fine independently, but I can't use the domain names for the https stream url's.
I have a few broadcasters using one of the streams, we do regular shows from my website, well we did until this.

My sites are down since last week, since I switched to ngnix, apache, vanish, php-fpm, Access Denied on websites.

That ioncube is a pain too, it's not compatible with newer PHP versions,
Then I saw they did a release for PHP 8.1 and installed PHP 8.1, no luck with the sites.

I'll try fix that SSL issues, as far as I know, it says I'm missing an A record
But I don't think the domains are missing any A records, not 100% sure.

I'm getting to oconfused, I have logs that are like 500mb, had to clear them just to open them.

I love CWP, it's just a bit stressful when things go wrong, i'll be up for the night again.
« Last Edit: September 05, 2023, 08:50:04 PM by emar »

Offline
*
Re: Apache won't start after upgrading to php 8+ (httpd failed)
« Reply #7 on: September 06, 2023, 08:23:45 AM »
I asked our data-center if there was a command to fix directories owner & group for each domain under /home/

For example

cd /home/domain-user
chown -R domain:domain public_html/

I have mentioned to CWP several times that the fix permissions option sets all directories owner & group to nobody.

I'm sure it's not suppose to do that so why does it?

Anyway, thank god the sites are back.

Offline
*****
Re: Apache won't start after upgrading to php 8+ (httpd failed)
« Reply #8 on: September 06, 2023, 02:19:19 PM »
I've never found their permissions fix to accomplish much of anything, so I ignore its existence. Here's a one-liner:
Code: [Select]
for user in $(ls /home); do chown -R $user:$user /home/$user/public_html ; doneIn fact, I see no reason not to take it up one level to the /home level:
Code: [Select]
for user in $(ls /home); do chown -R $user:$user /home/$user ; done

Offline
*
Re: Apache won't start after upgrading to php 8+ (httpd failed)
« Reply #9 on: September 07, 2023, 12:11:53 AM »
Is that command to set every domain's Owner & Group to their correct user?

Because I made the mistake of using this command and it set every domain's Owner & Group to the same user.
Which I discovered was wrong, because each domain under /home/ has it's own user.

for i in $(ls /home); do chown $i:$i /home/$i; done

Offline
*****
Re: Apache won't start after upgrading to php 8+ (httpd failed)
« Reply #10 on: September 07, 2023, 02:27:43 AM »
My one-liner works against normal system accounts (such as my overseer sudo user with a home of /home/overseer, as well as the tomcat user) and normal CWP hosting accounts. But for the /public_html directory, you will want the group to be nobody, as the web server needs to be able to traverse into that directory.
Code: [Select]
for user in $(ls /home); do chown $user:nobody /home/$user/public_html ; done

Offline
*
Re: Apache won't start after upgrading to php 8+ (httpd failed)
« Reply #11 on: September 07, 2023, 03:33:46 AM »
So if my domain's username is mix1 [under User Accounts > List Accounts]

for user in $(ls /home); do chown $user:nobody /home/mix1/public_html ; done

Would reset the public_html directory's Group to "nobody"
« Last Edit: September 07, 2023, 03:35:40 AM by emar »

Offline
*****
Re: Apache won't start after upgrading to php 8+ (httpd failed)
« Reply #12 on: September 07, 2023, 07:32:22 AM »
For your example, to apply permissions just to that one account:
Code: [Select]
chown mix1:nobody /home/mix1/public_html