Installing and using phpMyAdmin (4.2.2+) with ISPConfig 3+ (CentOS 6.5)

This guide assumes apache 2.2 and php 5.5 are already installed on the server (latest phpMyAdmin from remi, requires php 5). It also assumes working installation of ISPConfig 3+.

ISPConfig 3 currently uses mod_fcgid to as the default php handler. This causes problems, because the rpm-based (remi) distribution of phpMyAdmin only supports mod_php. Below are the steps to installing phpMyAdmin, and configuring it to run in an ISPConfig mod_fcgi environment.

In order to install the latest phpMyAdmin, the remi, and remi-php55 repositories are needed. You can read about installing the repositories here.

As of 2016/12/20 12:53, remi-php55 contains an RC version of phpMyAdmin 4. The remi repository contains the latest stable (4.2.2). Do not use package name 'phpmyadmin' as this will install the package from other repositories you may have (such as dag, or rpmforge), and it is very old.

yum install --enablerepo=remi --disablerepo=remi-php55 phpMyAdmin

After installing, go to /etc/httpd/conf.d, and rename the file phpMyAdmin.conf to phpMyAdmin.conf.rpmsave. This will de-activate the mod_php-based configuration file.

mv /etc/httpd/conf.d/phpMyAdmin.conf /etc/httpd/conf.d/phpMyAdmin.conf.rpmsave

phpMyAdmin, must then be enabled on a per-website basis in ISPConfig 3. Log in to the admin, and navigate to the website you would like to enable PMA for. On the Apache Directives box, paste the following:

# conf for enabling phpMyAdmin
# this is done per website.
Alias /phpMyAdmin /usr/share/phpMyAdmin
Alias /phpmyadmin /usr/share/phpMyAdmin
Alias /mysqladmin /usr/share/phpMyAdmin
 
<Directory /usr/share/phpMyAdmin/>
    <FilesMatch "\.php[345]?$">
        SetHandler fcgid-script
    </FilesMatch>
    FCGIWrapper /var/www/php-fcgi-scripts/{user}/.php-fcgi-starter .php
    FCGIWrapper /var/www/php-fcgi-scripts/{user}/.php-fcgi-starter .php3
    FCGIWrapper /var/www/php-fcgi-scripts/{user}/.php-fcgi-starter .php4
    FCGIWrapper /var/www/php-fcgi-scripts/{user}/.php-fcgi-starter .php5
    Options +ExecCGI
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>
 
<Directory /usr/share/phpMyAdmin/setup/>
    <FilesMatch "\.php[345]?$">
        SetHandler fcgid-script
    </FilesMatch>
    FCGIWrapper /var/www/php-fcgi-scripts/{user}/.php-fcgi-starter .php
    FCGIWrapper /var/www/php-fcgi-scripts/{user}/.php-fcgi-starter .php3
    FCGIWrapper /var/www/php-fcgi-scripts/{user}/.php-fcgi-starter .php4
    FCGIWrapper /var/www/php-fcgi-scripts/{user}/.php-fcgi-starter .php5
    Options +ExecCGI
    AllowOverride All
    Order Deny,Allow
    Deny from All
    Allow from 127.0.0.1
    Allow from ::1
</Directory>
 
<Directory /usr/share/phpMyAdmin/libraries/>
    Order Deny,Allow
    Deny from All
    Allow from None
</Directory>
 
<Directory /usr/share/phpMyAdmin/setup/lib/>
    Order Deny,Allow
    Deny from All
    Allow from None
</Directory>
 
<Directory /usr/share/phpMyAdmin/setup/frames/>
    Order Deny,Allow
    Deny from All
    Allow from None
</Directory>

Do not forget to replace {user} with the ISPConfig assigned linux user for the website (i.e. web10).

Also, you must append the following to the PHP open_basedir textbox:

:/usr/share/phpMyAdmin:/var/lib/phpMyAdmin:/etc/phpMyAdmin

After making the changes, hit the 'Save' button. The changes should be reflected shortly thereafter. Again, phpMyAdmin can only be enabled on a per-website basis, because of the use of suexec and website-specific permissions for fcgid.