Title: Manage Php
Course: CIS 208: Linux/UNIX III: Intermediate System Administration, Networking, and Security ~ For IGNITE Review > Section: Learning Modules

Manage Php

Php is currently in version 5.  Version 5 is not 100% compatible with either version 4 or version 3.  When working with php applications, be sure to check which version each application was written for.

To install php on a Red Hat like OS with support for mysql, run this command.

yum install php php-mysql

The main configuration file is /etc/php.ini.  Many default settings may be configured in this file.  Here are some of the settings that may need to be adjusted for particular applications.

short_open_tag
file_uploads
upload_max_filesize
date.timezone
error_reporting
memory_limit
session.save_path

Also these configurations can be applied in apache's httpd.conf file (or any included files).  This can be useful to override the system defaults for a specific directory or location.  For example, if error_reporting is set to E_ALL, but debug messages aredesired within /var/www/html/test, the following configuration in httpd.conf will set the php option for this directory.

<Directory /var/www/html/test/>
php_value error_reporting E_ALL | E_STRICT
</Directory>

To improve the performance of apache, it is recommended to use the "AllowOverride None" option for all directories.  This prevents the costly lookup of .htaccess files.  Some applications may say they require .htaccess files, but the settings within those files can be safely included using a php_value parameter in a Directory section of the httpd.conf file.  Disabling .htaccess files also enhance security, since the maintainers of the website files will not be able to affect the operation of the apache server.