Category: "EzPlatform / Ibexa"

Run eZ publish 4.0 on a server with PHP4 as the default and PHP5 available

My server has PHP4 as the default, and PHP5 available, indicated by the extension .php5. To use eZ publish 4.0, you need PHP5. To use it, one approach is to get a list of the PHP files, like so:

tar tzf eztagcloud.tgz > php_file_list

Use grep and sed to create a script to rename the files, as follows:

grep “\.php” php_file_list | sed “s/\(\(.*\)\.php\)/mv \1 \2.php5/” > php5

Make php5 executable:

chmod 700 php5

Untar the tar file:

tar xzf eztagcloud.tgz

Run php5:

./php5

Check by using:

ls -R eztagcloud/* | grep “php”

Change the filename.extension in the rewrite rules on the target from index.php to index.php5.

The include and require directives in the files must also be updated with the new extension. The file list extracted from the tar file could be used to feed a series of sed commands that substitute .php5 for .php.

grep “\.php” php_file_list | sed “s/\(\(.*\)\.php\)/sed –in-place \"s\/\\\.php\/\\\.php5\/\” \15/” > php52

Make php52 executeable.

If you don’t have alot of experience with eZ publish, and LAMP - this entire post should be considered extremely risky. However, it will not take long to check the success or failure of this idea - so it is definitely worth a try. Apologies for not testing it fully.

This approach should work for any application, and you may want to reverse it - so PHP5 is the default language, and PHP4 is accessible by extension. Good luck.

This link has some great suggestions about how to use htaccess to route all .php requests through php5. Set at the directory or account level, it may eliminate the renaming requiremnets. I couldn’t do it on my server, but others may be able to use it. Thanks to the author.
http://corz.org/serv/tricks/htaccess.php

.htaccess file

php5_value date.timezone 'America/Chicago'
php_value allow_call_time_pass_reference 0
php5_value magic_quotes_gpc 0


FilesMatch "."
order allow,deny
deny from all
/FilesMatch

FilesMatch "(index\.php5|\.(gif|jpe?g|png|css|js|html)|var(.+)storage.pdf(.+)\.pdf)$"
order allow,deny
allow from all
/FilesMatch


RewriteEngine On
RewriteRule content/treemenu/?$ index_treemenu.php5
RewriteRule index_treemenu.php5 - [L]

RewriteRule !\.(gif|jpe?g|png|css|js|html)|var(.+)storage.pdf(.+)\.pdf$ index.php5

DirectoryIndex index.php5

Run the installer - use .php5. Before you start fine tuning, be sure to change the extensions in settings/dbschema.ini and settings/codetemplates.ini.

Be sure to adhere to the requirements for eZ4, including eZ components, which can be processed with this approach as well.

*** This configuration is only intended for testing, production sites should be supported appropriately ***

1 2 3 4 6