• Please be aware: Kaspersky Anti-Virus has been deprecated
    With the upgrade to Plesk Obsidian 18.0.64, "Kaspersky Anti-Virus for Servers" will be automatically removed from the servers it is installed on. We recommend that you migrate to Sophos Anti-Virus for Servers.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Setting PHP as fastcgi after migration

freaky@

Regular Pleskian
Hi there,

we're in the process of migrating from 8.6 to 9.2.1. There are 2 major reasons for this, the first one is the distro no longer has security updates. The second one however is that it can now run PHP as fastcgi and this is the most important one for me. Mainly because I'm quite fed up with hacked joomla sites because users never update them. And with the access rights they normally need they get shell scripts installed and the kiddies can just browse the entire webserver (well not the entire server but atleast everything under /var/www/vhosts). Which is obviously very much unwanted, as they can read mysql passwords from config files etc.

Anyways, apparently you have a choice per domain. This is not really what I'm looking for (as far as I'm concerned entire server runs PHP as fastcgi, cgi and/or mod_php don't need to be options, they just allow for screw ups). I can set it in the template, so that should void 99% of it though.

Harder however are the existing domains. These all come over with mod_php. Been looking at the domain command, but this seems to only allow me to set PHP on or off, not what 'mode' it runs it in. This is also prevalent from the --info option on the domain. It doesn't output how it runs PHP just that it's enabled.

So I'm looking for a foolproof way to enable PHP as fastcgi on all existing domains easily (have to import 200 to 300). I can have a look at the database, probably just a flag and run the command to regenerate the httpd.conf and includes, but afraid that if I overlook something it will give issues later on or doesn't nicely update all the configs.

Any official ways of doing this? If I know what flags it are in the database tho' I can make a script to check the value on each domain every night so I can be alerted if one has it as something else than fastcgi.

TIA
 
YES! Please. This is something that would solve many headaches with our server.
 
Hello,

To modify many domains at once, go Home > Domains, select domains you wish to modify and click on "Modify" option. Scroll down to Hosting area, switch on "run PHP as" and choose a mode.

Regards,
Denis.
 
Thanks Denis.

Anyone know how to set "run PHP as FastCGI" as the default ... or better yet, disable running as apache?
 
Thanks for the re'. It works, but still doesn't allow me to check and it doesn't work like this for the subdomains (subdomains have their own settings, aliases however do not).

Unfortunately we have quite the amount of subdomains.

Anyways spitted through the db, think this suffices, it appears to... Use at your OWN risk though.

Log on to MySQL as admin (should have the same password as the admin account you log on to plesk) like so:

mysql -u admin -p

use psa;
update hosting set php_handler_type='fastcgi';
update subdomains set php_handler_type='fastcgi';
exit

Regenerate apache configs

/usr/local/psa/admin/bin/websrvmng -a

Reload apache (on our ubuntu install:)

/etc/init.d/apache2 reload

Prior to that, if your apache init script supports it (ubuntu's one doesn't) you might want to check the config with something like

/etc/init.d/apache2 checkconfig

DID I MENTION THIS COMES WITHOUT ANY WARRANTY? :p


You could ofcourse easily check now if domains have another setting with queries like

select * from hosting where php_handler_type != 'fastcgi';
select * from subdomains where php_handler_type != 'fastcgi';

I DID MENTION IT COMES W/O WARRANTY RIGHT?
 
Hi,

Does the db update query method also work with Plesk 9.3/9.5?

Thanks.
 
Last edited:
As far as I know it should yes.

Worked fine for me. With the exception of some issues with fastcgi PHP, but those came from my distro.

Afaik it should work yes. The update ran fine for us.

You can try "apache2ctl configtest" to test the config afterwards. If your machine runs virtual you can always snapshot it, try it and revert if it doesn't work (I'd pick a pretty much idle time for that tho', restoring snapshot might cause loss of data).

Had some issues with PHP as fastcgi itself, but comes from the distro (issues with typo3, it's known on ubuntu 8.04 with it's PHP version... Doesn't seem like they ever really solved it though).
 
Back
Top