2

I just installed php5-cgi on my Ubuntu 12.04. I am not sure about:

  1. What configuration I will need to do in nginx config file to use it.
  2. How will I start the service, as sudo service php5-cgi says "unrecognized service"

1 Answer 1

1

The package php5-cgi doesn't include a service that can be started.

From the package description:

This package provides the /usr/lib/cgi-bin/php5 CGI interpreter built for use in Apache 2 with mod_actions, or any other CGI httpd that supports a similar mechanism. Note that MOST Apache users probably want the libapache2-mod-php5 package.

Therefore you need an installed web server like Apache.

To enable php5-cgi create a symbolic link

sudo ln -s /etc/apache2/conf-available/php5-cgi.conf /etc/apache2/conf-enabled

and change the configuration via

sudo nano /etc/apache2/conf-enabled/php5-cgi.conf

An other option to enable an apache2 module is a2enmod. Therefore you could also use

sudo a2enmod php5-cgi

After that don't forget to restart the apache2 service

sudo service apache2 restart

as commented by @ThomasW.

for nginx you should be using php5-fpm, NOT php5-cgi

2
  • Also note that for nginx you should be using php5-fpm which is what the nginx people recommend, and NOT php5-cgi.
    – Thomas Ward
    Sep 7, 2015 at 12:30
  • I was earlier thinking that nginx will fall under "or any other CGI httpd that supports a similar mechanism", but I guess not. php-fpm worked for ngingx. Thank you!! :D Sep 8, 2015 at 17:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .