Configuring PHP is the next step after installing PHP on Ubuntu. The main PHP configuration that Apache uses is in /etc/php5/apache2/php.ini. As with many Ubuntu configuration files, there are so many comments and options in Ubuntu's main php.ini file that it can be overwhelming. Even the number of options are daunting.
The main syntax of the file is simple. Lines preceded by a semicolon (';') are ignored. Section headers, those lines beginning with a squared bracket ('['), are also ignored (but may mean something in releases after PHP 5.3). The rest are directives that modify the behavior of PHP.
The values of directives are basic equalitative statements: x = y. So, for example, to load the PHP scripting engine under Apache, we tell it to turn the PHP engine on:
engine = OnNote that the line delimiter is the carriage return so no further marker is needed to indicate the end of the line. Similarly, unless the value is to be quoted verbatim, you do not need to put the value in quotes.
From the various options available in the php.ini file, PHP is obviously very flexible. That flexibility can also make it difficult to control. Fortunately, Ubuntu ships with a very reasonable default php.ini file. But even this can be a bit daunting. To ease the pain, you may want to read our discussion of PHP configuration in-depth. Once you have setup PHP to work with your Apache installation, you will want to ensure it is setup to work with your MySQL installation, as well. These form the basis of a functioning LAMP installation (or LAMP stack) and pave the way for advanced web development.
|Install PHP||Basic PHP Configuration||PHP Configuration In-Depth|
|Learn PHP||PHP in HTML||PHP Keywords|
|PHP Expressions||PHP Variables||PHP Constants|
|Defined Constants||Constants Characteristics||PHP Datatypes|
|PHP Syntax Basics||PHP Loops|