Increase PHP script execution time with Nginx

If you have a large WordPress setup or a server with limited resources, then you will often see the “504 Gateway Time-out” error.

You can follow the steps given below to increase the timeout value. PHP default is 30s.

Changes in php.ini

If you want to change max execution time limit for php scripts from 30 seconds (default) to 300 seconds.

Set…

In Apache, applications running PHP as a module above would have suffice. But in our case we need to make this change at 2 more places.

Changes in PHP-FPM

This is only needed if you have already un-commented request_terminate_timeout parameter before. It is commented by default, and takes value of max_execution_time found in php.ini

Edit…

Set…

Changes in Nginx Config

To increase the time limit for example.com by

If you want to increase time-limit for all-sites on your server, you can edit main nginx.conf file:

Add following in http{..} section

Reload PHP-FPM & Nginx

Don’t forget to do this so that changes you have made will come into effect:

Source : https://rtcamp.com/tutorials/php/increase-script-execution-time/

Easy steps to parse RSS/Atom feeds into Array with PHP

Very simple script to parse RSS/Atom feeds into php array 🙂

Source : http://stackoverflow.com/a/19751841

How to install mcrypt for PHP in ubuntu

apt-get install php5-mcrypt
/etc/init.d/apache2 restart

Sometimes you might get the message “php5-mcrypt is already the newest version“. If so, install with:

apt-cache search php5-m
php5-mapscript – php5-cgi module for MapServer
php5-mcrypt – MCrypt module for php5
php5-memcache – memcache extension module for PHP5
php5-ming – Ming module for php5
php5-mhash – MHASH module for php5
php5-mysql – MySQL module for php5
php5-sybase – Sybase / MS SQL Server module for php5

apt-get –reinstall install php5-mcrypt
/etc/init.d/apache2 restart