Web Hosting PHP5 Support

Summary

Several web hosts claim to offer PHP 4 and PHP 5 support while offering PHP 4 by default. This is due to a specific approach that can serve PHP 4 and PHP 5 concurrently on the same Apache server using FastCGI.

Troubleshooting

Normally, loading mod_php4 and mod_php5 on the same Apache server casuses segmentation faults (which is bad). The solution is running one of the PHP versions as a CGI program. Although FastCGI is faster than normal CGI, it is generally slower than running PHP as a module. Some benchmarks put performance of PHP 5 running under FastCGI to have about 80% of the performance of running mod_php5. In the case of deploying large scale online stores using Shopp, using mod_php5 is preferred.

When running under mod_php5 is not possible, and you are using a host that offers it, you can enable PHP 5 for your WordPress/Shopp install by adding the following to your .htaccess file in your main WordPress directory:

<IfModule mod_fastcgi.c>
AddHandler application/x-httpd-php5 .php
</IfModule>

PHP 5 Requires .php5 File Extension

Some hosts provide PHP 5 support but require that you name your files with a .php5 extension (as opposed to just .php) in order for them to be interpreted with PHP 5. Shopp files all use the .php extension so this won’t work. You could rename all of the Shopp files, but things will break when any update is performed, requiring you to rename all of Shopp’s files again.

A solution for this is to remap the PHP5 handler to use the .php extension. You can do this by editing the .htaccess file in your main WordPress directory and add the following:

AddHandler application/x-httpd-php5 .php
AddHandler application/x-httpd-php .php4

Editing the .htaccess file

The .htaccess (HyperText access) file is a special file for the Apache web server that acts as a site-specific configuration file. Configuration directives are added to .htaccess files that are placed in a particular directory. Any directives within the file are applied to that directory and any sub-directories of that directory.

WordPress primarily makes use of the .htaccess file to handle URL rewriting to support pretty urls. There are several WordPress plugins that also make use of the .htaccess file.

To edit the .htaccess file on a remote web site, you will need to access your website either using FTP software, or using the command-line over an SSH connection. If you’re able to use SSH, you don’t need a guide on how to edit the file, so this mini-guide will focus on FTP editing.

First, connect to your website with your FTP software. Your FTP software (also known as a client) will need to be configured to view hidden/system files. In the Unix world, any filename preceded with a . (dot) becomes hidden and are typically known as dotfiles. Each FTP client is different, so to figure out how to view hidden files, refer to the FTP software’s help files, documentation or do a search on the web.

Once enabled, you can now download, make changes to the file in a text editor, save them and upload your changes back to the server.

See Also

Web Hosting PHP5 Support
  • 0.00 / 5 5

You must be logged in to post a comment.

© Ingenesis Limited. Shopp™ is a registered trademark of Ingenesis Limited.

Skip to toolbar