Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install PHP extensions on nginx?

I recently discovered NginX, and decided to try it out on my server. I have NginX running and able to serve PHP and HTML files. But now I want to try to install drupal. When trying to install it and check the requirements, I am stopped by one requirement.

PHP extensions Disabled

Drupal requires you to enable the PHP extensions in the following list (see the system requirements page for more information):

gd

I have tried to install gd by doing apt-get install php5-gd, and it says it is already installed. So I created a phpinfo() file, and checked to see if gd was enabled and I wasn't able to find it. Does this have to do with NginX or PHP? What do I do to fix this?

like image 218
samwell Avatar asked Jan 13 '12 23:01

samwell


People also ask

What is PHP-FPM in nginx?

PHP-FPM (FastCGI Process Manager) is an alternative to FastCGI implementation of PHP with some additional features useful for sites with high traffic. It is the preferred method of processing PHP pages with NGINX and is faster than traditional CGI based methods such as SUPHP or mod_php for running a PHP script.

What is FastCGI Nginx?

FastCGI is a binary protocol for interfacing interactive programs with a web server. It is a variation on the earlier Common Gateway Interface (CGI).

What is PHP-FPM used for?

Q: What is PHP-FPM used for? A: PHP-FPM (FastCGI Process Manager) is a web tool used to speed up the performance of a website. It is much faster than traditional CGI based methods and has the ability to handle tremendous loads simultaneously.


2 Answers

Since you are using Nginx - that must mean you are running PHP with PHP-FPM.

After you install stuff you need to:

sudo /etc/init.d/php-fpm restart 

or

service php5-fpm restart

in newer ubuntu versions

so that PHP will pickup the new extensions.

like image 153
Xeoncross Avatar answered Oct 18 '22 14:10

Xeoncross


If your web server setup is in order, only install the php gd extension and restart php scripting interpreter and web server.

sudo apt-get install php5-gd
sudo /etc/init.d/php-fastcgi stop
sudo /etc/init.d/php-fastcgi start
sudo /etc/init.d/nginx stop
sudo /etc/init.d/nginx start

Here's a great LEMP tutorial http://library.linode.com/web-servers/nginx/php-fastcgi/ubuntu-10.04-lucid

like image 40
augusto Avatar answered Oct 18 '22 14:10

augusto