Customizing PHP

The process of obtaining and installing the PHP Development add-on differs for Storefront and ServerXchange customers.

Storefront customers: Storefront customers receive the add-on along with the control panel software. When the control panel software is installed, the add-on is automatically installed. Please disregard the section, Installing the PHP Development add-on. The first step is to obtain the source RPM from Ensim's FTP server.

ServerXchange customers: The add-on is available as a suite for download from Ensim AppXchange®. Once the add-on is downloaded, it must be explicitly selected for installation.

To customize PHP, you need to:

- Install the PHP Development add-on

- Obtain the PHP source RPM

- Install the PHP source RPM on the server

- Modify the PHP source file

- Rebuild PHP source RPM

- Install the rebuilt PHP RPMs on the server

# Installing the PHP Development add-on

The first step, for ServerXchange customers, is to install the PHP Development add-on onto the server. This service contains the development packages needed to rebuild PHP.

To install the PHP Development add-on:

1. Connect to the Server & Application Manager.

2. Click Servers on the left navigation bar.

3. Locate the server on which you want to install and click on the host name of the server.

4. Click the Applications tab.

5. In the Applications submenu, click Install.

6. Locate PHP Development Addon and select the check box in the Select column.

7. Click Next.

8. Click Next again.

9. Click Finish.

PHP is installed on your server.

# Obtaining the PHP source RPM

In order to rebuild PHP, you must obtain the PHP source RPM. The PHP source RPM must be downloaded from the FTP site, ftp://download.fedora.redhat.com.

To download the PHP source RPM:

1. Connect to the FTP site,
   ftp://download.fedora.redhat.com/pub/fedora/linux/core/<OS_version>/i386/os/SRPMS/
   You may obtain the latest RPM updates at ftp://download.fedora.redhat.com/pub/fedora/linux/core/updates/<OS_version>/SRPMS/
   where <OS_version> is the version of the Fedora™ Core operating system installed.
   Optionally, for an optimal download, connect to a Fedora mirror Web site. You can obtain a list of mirror sites at http://fedora.redhat.com/download/mirrors.html.

2. Download the PHP source RPM.

# Installing the PHP source RPM on the server

To install the PHP source RPM:

1. Connect to the server.

telnet <myserver_name>

or

ssh <username@myserver_name>

2. Install the PHP source RPMs on the server using the following command:

rpm -ivh --define '_topdir <dir_name>' <php_src_rpm>

where:

<dir_name> is the directory where you want to install the source files

<php_src_rpm> represents the PHP source RPM

- Important: You must specify a top level directory if you are installing the RPM as a normal user, otherwise you will be unable to install the PHP source RPM. If you are installing the PHP source RPM as the root user, the topdir need not be defined.

# Modifying the PHP source file

You need to modify the PHP source file, php.spec, to customize the capabilities of PHP.

To modify the PHP source file:

1. Change your working directory to the directory where you installed the PHP source files.

cd <dir_name>

where <dir_name> is the directory where you have installed the PHP source files.

2. Create the following directories, BUILD, RPMS/i386, SRPMS, using the following command.

mkdir -p BUILD RPMS/i386 SRPMS

- Important: Since the Linux environment is case sensitive, you must ensure that the directory names are capitalized.

3. Modify the php.spec file that contains the configurable options for PHP.

vi <topdir>/SPECS/php.spec

- Important: Modifying certain options in the php.spec file could adversely affect the functioning of certain features of the control panel.
  For example, if you disable PhpMyAdmin or MySQL, your customers will be unable to manage their MySQL databases using the PhpMyAdmin MySQL interface.
  Similarly, if your disable IMAP, you cannot access your email messages using SquirrelMail.
  If you disable the gettext option, internationalization of PhpMyAdmin and SquirrelMail will not be supported.

4. Save your changes to the file and exit.

:wq

# Rebuilding the PHP source RPM

To rebuild the PHP source RPM:

1. Build the PHP source RPM using the following command.

rpmbuild --define '_topdir <dir_name>' -ba <dir_name>/SPECS/php.spec

If the process exits with "state 0", it indicates that the rebuild is successful.

The rebuilt RPMs will be available in the location, /<dir_name>/RPMS/i386.

# Installing the rebuilt PHP RPMs on the server

After rebuilding the PHP source RPM, you must install the rebuilt PHP RPMs on the server.

1. Log on to your server as a root user.

su -

2. Browse to the folder, /<dir_name>/RPMS/i386, that contains the recompiled RPMs.

3. Install the RPMs using the following command.

rpm -Uvh *.rpm

4. Restart the Web server.

5. Note: You need to restart the Web server to enable the customized capabilities.