Using PHP Version 5

From EnGardeWiki

Jump to: navigation, search

Introduction

EnGarde Secure Linux ships with both PHP versions 4 and 5. While version 4 is used "out of the box," using version 5 is as easy as changing installing a couple of packages and changing one line in the machines httpd.conf. This document is intended to guide the reader through the process of configuring the EnGarde Secure Linux machine to use PHP version 5.

Procedure

The first step is to install the PHP version 5 packages. To do this, log into WebTool and navigate:

System -> Guardian Digital Secure Network -> Module -> Package Management

Install the following packages:

mod_php5 (required)
php5 (required)
php5-imap (optional)
php5-mysql (optional)

Click the Install Selected Packages button. Confirm that you want to install the packages and proceed by clicking Install These Packages. Once these packages are installed, log into the machine as root and transition over to sysadm_r:

[root@engarde ~]# newrole -r sysadm_r
Authenticating root.
Password:

Open the file /etc/httpd/conf/httpd.conf in a text editor:

[root@engarde ~]# vi /etc/httpd/conf/httpd.conf

PHP support is controlled by the inclusion of a configuration file. By default, PHP version 4 is enabled and PHP version 5 is disabled. To enable PHP version 5 locate the following line:

Include /etc/httpd/conf/php4.conf

and change it to:

Include /etc/httpd/conf/php5.conf

You may then restart the Apache webserver by either running the command:

[root@engarde ~]# /etc/init.d/httpd restart
[ SUCCESSFUL ] Apache Web Server
[ SUCCESSFUL ] Apache Web Server

Or by using WebTool:

Services -> Service Configuration -> httpd

You're all set! PHP version 5 will now be associated with all .php files.

Advanced Notes

While it's possible to use both PHP versions 4 and 5 at the same time, this document only tells you how to use one at any given time. If you figure out how to use them both feel free to update this space :)

Personal tools