PHP

Installation

In order to process PHP requests, Nginx needs an additional package

$ sudo apt-get install php-fpm 

Configure Nginx to Use the PHP Processor

Now, we need to tell Nginx to use the PHP processor for dynamic content.

We edit the /etc/nginx/sites-enabled/task.woezzon.com.conf file and put

$ sudo nano /etc/nginx/sites-enabled/task.woezzon.com.conf

We can check the configuration file with

$ sudo nginx -t

If everything is ok , we simply restart the server

$ sudo /etc/init.d/nginx restart

To test the PHP configuration, we create a simple php file with the content

$ sudo nano /var/www/html/info.php

// with the content
<?php
 phpinfo();
?>

Configuration of php.ini

We can visit the page with the link http://task.woezzon.com/info.php

After we update php.ini configuration in order to accept big file upload

$  cd /etc/php/7.0/cli/
$ sudo nano php.ini
		file_uploads = On # must be set to "On"
		upload_max_filesize = 24M # can't be larger than post_max_size
		max_input_time = 300 # small values may cause timeouts for large file uploads
		memory_limit = 64M # small values may cause out of memory errors for large file uploads
		max_execution_time = 180 # small values may cause timeouts for large file uploads
		post_max_size = 24M # limits the size of input submitted to the website (including attached files)

Last updated

Was this helpful?