IndexCookbook

Cookbook: Setting up phpMyAdmin

Setting up phpMyAdmin to work with Cherokee is trivial, as Cherokee already provides everything that is needed to work.

According to phpMyAdmin's documentation, the software requirements are just:

  • PHP:

    • You need PHP 5.2.0 or newer, with session support and the Standard PHP Library (SPL) extension.

    • To support uploading of ZIP files, you need the PHP zip extension.

    • For proper support of multibyte strings (eg. UTF-8, which is currently default), you should install mbstring and ctype extensions.

    • You need GD2 support in PHP to display inline thumbnails of JPEGs ("image/jpeg: inline") with their original aspect ratio

    • When using the "cookie" authentication method, the mcrypt extension is strongly suggested for most users and is required for 64–bit machines. Not using mcrypt will cause phpMyAdmin to load pages significantly slower.

  • MySQL 5.0 or newer (details);

  • Web browser with cookies enabled.

This means that you don't need to modify Cherokee at all provided you have PHP with MySQL support and you are using a default Cherokee configuration.

Express setup

The only thing you need to do is make phpMyAdmin accessible by Cherokee and all the script files must have permissions suitable for the user running Cherokee.

Most platforms provide packages with all that you need. For Debian based Linux distributions, You can issue the following commands as root (or through sudo) and the whole installation will take a matter of seconds.

Example: Debian installation
# apt-get install php5-cgi php5-mysql mysql-server-5.0 phpmyadmin
# ln -s /usr/share/phpmyadmin/ /var/www/phpmyadmin

Since Cherokee doesn't appear in the list of web servers provided by the package installation script, select any of them to proceed with phpMyAdmin's configuration.

The commands above asume you are running Cherokee as root and that your web server's document root is /var/www.

If you were to run it as www-data, simply change the script's owner:

Example: Script owner
# chown -R www-data:www-data /usr/share/phpmyadmin

Now point your web browser to http://localhost/phpmyadmin, and use the MySQL user information to access the databases.

phpMyAdmin in action!

Generic setup

If your platform doesn't provide phpMyAdmin, download it from the main download site and follow the Quick Install notes in the phpMyAdmin documentation. As before, you simply need to make the program accessible to your web server, so either install directly under your document root or make a symbolic link.

Considerations

  • Cherokee's default setup encodes the output of PHP with gzip, which in turn improves the server's performance. You will get garbled output if you also enable phpMyAdmin's gzip compression, since your web browser will be receiving content encoded twice.

  • If you are using the auth_type config, it is suggested that you protect the phpMyAdmin installation directory because using config does not require a user to enter a password to access the phpMyAdmin installation. Use of an alternate authentication method is recommended, either by switching to using auth_type cookie or http, or alternatively by using Cherokee's authentication features. Refer to the phpMyAdmin documentation for more details on the former, or to our link;cookbook_authentication.html[authentication recipe] for the latter.

  • It is generally good idea to protect public phpMyAdmin installation against access by robots as they usually can not do anything good there. You can do this using robots.txt file in root.

  • You should deny access to the ./libraries and ./setup/lib subfolders in Cherokee's configuration. Such configuration prevents from possible path exposure and cross side scripting vulnerabilities that might happen to be found in that code. To do so, configure directory-type rules for those and manage them with the HTTP Error handler.

Protected directories
Can you improve this entry?