Create php configuration file by copying to /usr/local/etc/php.ini one of these files:
Edit newly created php.ini, find and adjust at least the following:
- memory_limit - Maximum amount of memory a script may consume
- post_max_size and upload_max_filesize - maximum POST uploads
- max_execution_time, max_input_time - maximum script execution time
- date.timezone - set it to your default timezone
Refer to php docs on other configuration settings. For example, you might want also to change error_reporting, display_errors, display_startup_errors and log_errors settings.
Update: At least with PHP 5.6 this section is obsolete now. Maintainer took care of the extensions order by splitting extensions.ini into separate ext_N_NAME.ini files, so they are now loaded in correct order. But if your PHP version is still using single extensions.ini then read on.
Some extensions depend on other extensions to be loaded before them. For example, memcached.so wants to be loaded after session.so. Here's a simple trick to make it work:
# cd /usr/local/etc/php # cat extensions.ini | sort > extensions.ini.new # mv extensions.ini.new extensions.ini
Now edit the file extensions.ini and move the session.so line before the memcached.so line.
In order to check everything is OK just run:
> php -v PHP 5.4.30 (cli) (built: Jul 8 2014 06:12:34) Copyright (c) 1997-2014 The PHP Group Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies
This will print error messages if something is wrong.
PHP-FPM (If you have enabled this option)
The configuration file is /usr/local/etc/php-fpm.conf. FPM is usable out of the box as it comes preconfigured with a pool 'www' running as www user on 127.0.0.1:9000.
Add to /etc/rc.conf:
# service php-fpm start
Add to /etc/newsyslog.conf:
/var/log/php-fpm.log root:wheel 640 7 * @T00 BJG /var/run/php-fpm.pid 30
# service newsyslog restart