1. Please take a little time for this simple survey! Thank you for participating!
    Dismiss Notice
  2. Dear Pleskians, please read this carefully! New attachments and other rules Thank you!
    Dismiss Notice
  3. Dear Pleskians, I really hope that you will share your opinion in this Special topic for chatter about Plesk in the Clouds. Thank you!
    Dismiss Notice

Setting PHP as fastcgi after migration

Discussion in 'Plesk 9.x for Linux Issues, Fixes, How-To' started by freaky@, Jun 22, 2009.

  1. freaky@

    freaky@ Regular Pleskian

    26
     
    Joined:
    May 2, 2006
    Messages:
    104
    Likes Received:
    0
    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
     
  2. Joshua Sortino

    Joshua Sortino Guest

    0
     
    YES! Please. This is something that would solve many headaches with our server.
     
  3. Denis Sirochenko

    Denis Sirochenko Guest

    0
     
    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.
     
  4. Joshua Sortino

    Joshua Sortino Guest

    0
     
    Thanks Denis.

    Anyone know how to set "run PHP as FastCGI" as the default ... or better yet, disable running as apache?
     
  5. freaky@

    freaky@ Regular Pleskian

    26
     
    Joined:
    May 2, 2006
    Messages:
    104
    Likes Received:
    0
    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?
     
  6. thewolf

    thewolf Regular Pleskian

    25
    57%
    Joined:
    Mar 11, 2004
    Messages:
    231
    Likes Received:
    0
    Hi,

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

    Thanks.
     
    Last edited: Aug 23, 2010
  7. freaky@

    freaky@ Regular Pleskian

    26
     
    Joined:
    May 2, 2006
    Messages:
    104
    Likes Received:
    0
    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).
     
Loading...