I'm relatively new to the world of unix command line web server management/administration.
Many hosts with control panel administration options allow you to change how PHP is run with a simple option.
The most common options being:
- apache module
- CGI application
- FastCGI application
My question is simply, how do you change this via the command line? I know there are many configuration files for apache.
The closest thing I have found is this question, however the directory structure does not seem to match for my OS (Ubuntu 12.04).
I'm quite bewildered how there does not seem to be a clear guide that I can find that details this process for something that seems to be so common. Forgive me if this exists… if so, please point me in the right direction.
Best Answer
Thanks for previous answers they got me most of the way, but to get things working I had to combine instructions from a few places, so thought I would write up a complete set of commands.
FYI I'm running Ubuntu 14.04, Apache 2.4, and also had modphp running by default, previous instructions also left out the need to disable modphp.
I also found http://blog.starcklin.com/2013/08/install-mod-fastcgi-and-php5-fpm-on-ubuntu/ to be very informative and straightforward.
Just run the following commands in a terminal one after the other.
First install the necessary packages (I leave out php5 as this assumes it's already installed, add it back in for a first time install). Also note from Apache 2.4 up you can use the event-mpm instead of worker see http://www.vps.net/blog/2013/04/08/apache-mpms-prefork-worker-and-event/. My example shows worker, but just replace the word worker with event if you'd rather use that.
Now enable mods you need, and disable those you don't.
Create the php5.fcgi file and give the webserver permission to use it.
Create a global config for php5-fpm
paste in the following (we'll use a socket instead of IP address)
Enable the php5-fpm conf
Restart apache and fpm
As per other instructions paste the following into a new browseable php file on your webserver.
Open the file you just edited in a web browser, If you see "FPM/FastCGI" next to Server API, you are now serving PHP with FastCGI!