The behavior of your PHP runtime (security, memory, and performance) can be configured using a
php.ini file. This is the file that instructs how PHP should behave before executing your PHP application code.
You can edit your php.ini file directly, however, you can share the same PHP runtime but have different settings per application. With Apache, for example, configure the server to allow access to a .htacess file with specific php declaritives to override the default
You can use shorthand
<? instead of
<?php when opening PHP code.
PHP has many levels of errors:
E_WARNING, etc. This directive allows you to decide the magnitude of warning. You can convert your errors into exceptions. Doing so, you can catch and handle them. You can do this with the
ErrorException class with
set_error_handler() function. You can also use this with
display_errors when configuring the handling of display errors in production.
sudo nano /etc/php5/fpm/pool.d/www.conf
Uncomment these the following three lines, if not already.
user = www-data group = www-data listen.mode = 0660
Change strings to match the following.
post_max_size = 50M upload_max_filesize = 50M memory_limit = 128M