There are a couple changes I immediately make to the default php.ini configuration when setting up an application server. Before making any modifications, we should backup the package maintainer's version of the configuration file.
sudo cp /etc/php5/apache2/php.ini /etc/php5/apache2/php.ini.orig
Increase upload size
If the application requires file uploading, 2MB won't get you very far. Image or video uploads will quickly exceed this limit. The following sed command will increase the upload limit to 10MB. Adjust as needed.
sudo sh -c "sed -i '0,/upload_max_filesize = 2M/s//upload_max_filesize = 10M/g' /etc/php5/apache2/php.ini"
Turn off X-Powered-By header
Exposing the server PHP version is unnecessary and a potential security risk if we are using an outdated version that has any known vulnerabilities. The expose_php setting should always be turned off in production environments.
sudo sh -c "sed -i '0,/expose_php = On/s//expose_php = Off/g' /etc/php5/apache2/php.ini"