503 site unavailable after chaning php execution mode

SYSTEM INFORMATION
OS type and version Ubuntu 20
Virtualmin version Latest

I am getting 503 site unavailable after changing PHP Execution Mode from FSGI to FPM.
Do I have to change anything more ?

Could you list the appropriate entries in the web server error log?

@Mayanktaker,

What does the error log for the site(s) say?

@tpnsolutions & @calport

I am getting same apache error log for all sites :slight_smile:

AH01079: failed to make connection to backend: 127.0.0.1
111)Connection refused: AH00957: FCGI: attempt to connect to 127.0.0.1:8007 (*) failed
AH01067: Failed to read FastCGI header
 AH01630: client denied by server configuration: /home/username/public_html/server-status

I see from the screenshot that you have mod_php installed! Get rid of it immediately!!

If Joe finds out that you have mod_php installed on a Virtualmin system, he might banish you from the forum forever.

1 Like

What ? How? I think I installed it mistakenly by following some tutorials (how to install new php versions)…
What is that ? How can I get rid of it ?

You weren’t following our tutorials, because our tutorials never suggest installing mod_php.

You uninstall the package(s) that contain mod_php. That would be libapache2-mod-php and php (which is a metapackage that pulls in mod_php). But, you may also have other versions. I’m not going to try to guess. You’ll need to ask your package manager.

dpkg -l | grep mod-php

And, remove any mod_php packages you have:

dpkg --purge libapache2-mod-php

You have to purge it, because it’s the config files bundled in the package that breaks all other execution modes.

Y’all please stop installing mod_php. I’m begging. Every day, multiple people break all other execution modes (and thus all their existing websites) by installing mod_php. There is never a reason to install mod_php.

2 Likes

I uninstalled that completely. I didn’t know about that. I am sorry for that.
Now My Apache is not restarting. I have to comment php_admin_value engine Off on my each server…

Oh, dang. You can probably fix that within Virtualmin by doing Re-check configuration and Validate virtual servers. It might even need you to switch execution modes back and forth…so maybe just fixing it in the config file is better.

But, don’t comment it out, just delete the bastards. You will never install mod_php again, so those php_admin_value directives will never make sense to Apache. They are not useful to have in your config file, as long as you never install mod_php again.

2 Likes

Thank you very much for motivating me. :smiley: IS there any other way to remove those tags from all my virtual servers at once?
I read this : sed -i ‘s/php_value/#php_value/g’ /etc/httpd/conf.d/php.conf
but before executing the command, I checked that there is no etc/httpd directory in my server.

That doesn’t do anything useful. You’ve already removed php.conf, assuming you actually purged all the mod_php packages. You need to remove php_admin_value from your virtual host configuration files, not php.conf.

Because you’re using Ubuntu, which has /etc/apache2. Ubuntu also puts vhosts into a subdirectory, and each domain gets its own file. So, you’ll need to apply your sed command to all of them.

Removing lines with sed is no more difficult than commenting them out: https://kifarunix.com/delete-lines-matching-a-specific-pattern-in-a-file-using-sed/

Just be careful with in-place (-i) mode. Make sure your pattern and commands do what you intend before overwriting all of your Apache configuration files.

Learning a little sed will save you hours or days of time and frustration in the future. Now’s a great time to start.

1 Like

I did it after reading your comment. I removed them one by one. Now All my sites are running normally. I can sleep in peace now. Thank you so much.!! <3
Edit: Definitely going to learn sed. :slight_smile:

1 Like

This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.