User:Terrye/Configuring php.ini for phpBB

Every time PHP starts up, it loads one or more configuration files which define the behaviour of any PHP scripts. Individual users can replace some or all of these. This article discusses what you should change to support phpBB on a shared service.

= The default PHP settings for your site = To discover what the default settings for your site are, create the following temporary PHP script using FTP and your preferred source editor in your public HTML file hierachy, then execute it to get the PHP and configuration for your system. Alternatively if you already have phpBB installed, up and running then you can run the same report when logged onto phpBB as an administration through ACP->System->PHP information. 

This will give you a lot of useful information about your web service including: The PHP documentation and various web resources will give you more details.
 * The PHP version. You should know this. It should really be at least 5.2.3 and if not then your system is pretty dated. Version 5.3 has some nice new feature if you are scripting your own custom code.
 * The Server API. If it is something like "Apache 2.0 Handler", this is very unusual for shared services as this introduces severe security vulnerabilities and data protection issues since you and 3rd-party accounts will be running your scripts under mod_php within the same UID. So this will probably be CGI/FastCGI if your HSP is running suPHP or just GCI if running suExec. Both of these tell you that you scripts will be run in the context of you own account UID, and therefore include the ~50-100 mSec overhead of PHP activation per web request.
 * A list of and settings all of the PHP extensions available to your scripts.
 * The PHP Variables. These include the absolute path of your home directory and other useful information.

In the CGI variants, as each script request involves its own PHP activation, this give you the ability to set up your own php.ini files in each directory from which you will execute scripts. The easiest way to do this is to keep one central master, and set up symlinks (shortcuts) to this from each directory where you run scripts. Also remember the load order for such configuration scripts is:
 * The master copy in the /etc file hierarchy.
 * Your in-directory copy
 * The module config scripts pathed in from V/etc/php.d or equivalent.

Hence your ini entries will override the master ones, but the module-specific ones will override yours.

= Example php.ini = ; ; Some advised defaults for a production set to tighten down security, etc. ; magic_quotes_gpc = Off register_argc_argv = Off register_long_arrays = Off track_errors = Off url_rewriter.tags = Off variables_order = "GPCS" short_open_tag = Off upload_max_filesize = 8M date.timezone = "UTC" session.gc_divisor = 1000 session.hash_bits_per_character = 5 session.gc_maxlifetime = 7200 ; ; This one is an important performance parameter ; output_buffering = On ; ; Always collect errors so that you can review them, and identify any problems. ; You typically won't have access to Apache error logs on a shared service, so ; define your own error log, using an absolute path. ; log_errors = On error_log = " /your_public_html /_private/PHPerror.log" ; ; If you are not using mod_deflate to do your HTML stream compression enable it ; here using the ;