PHP Installation
From T5C
PHP has become a worldwide standard for web application development atop open platforms like the LAMP stack. In fact, PHP is widely recognized as the "P" in LAMP. In this article we will cover installation and configuration of PHP in preparation for a future Moodle install.
[edit] Install PHP
The CentOS yum repositories contain the PHP packages and the additional extensions that specific applications may require. Moodle is one such application, requiring a set of extensions to be installed with the core PHP package for the proper operation of the system. The following command installs all of these components at once:
yum install php php-gd php-imap php-mysql php-mbstring php-mcrypt
Note that the php-mcrypt package is only available via the CentOS Plus repository so make sure to enable this repo in the file /etc/yum.repos.d/CentOS-Base.repo .
That's all there is to it! Once yum finishes processing, PHP and the required extensions are now installed on your system.
[edit] Configuring PHP
PHP may be installed but unless you restart the Apache web server, it won't have any effect on the system. Before restarting Apache to activate PHP, we must make some changes to the PHP configuration file. Edit the file with vi:
vi /etc/php.ini
There are three configuration variables whose values have to be modified for the future Moodle installation. These are located in different parts of the php.ini file so you need to search using vi's "/" command.
memory_limit = 64M upload_max_filesize = 128M post_max_size = 128M
These settings will allocate the necessary resources to PHP for a proper Moodle installation. Once you specify these values, save and exit the vi editor and restart Apache with:
service httpd restart
Once Apache has restarted, PHP is now enabled and any files with the ".php" extension that are placed in your web root or beneath will be processed for PHP statements.

