Switching to PHP5 on 1and1 Linux Hosting
Beware this content is over 10 years old and considered stale. It may no longer be accurate and/or reflect the understanding of the author but remains here for reference only. Please keep this in mind as you use this content.
I recently upgraded a client to a 1and1 Linux Business Pro hosting package and so far I have found no major obstacles.
Within the hosted environment, the access you have to installation directories or configuration files is nil. One related error I came across within the first few minutes of moving an installation of Joomla! 1.5.x from the Win2k3 environment running IIS to the Linux host running Apache was that the following error:
Parse error: syntax error, unexpected T_OBJECT_OPERATOR
The error, in this case, was caused by the fact that the server was running PHP4 whereas the Joomla! installation required PHP5 to operate. In a dedicated environment this wouldnt be problem, merely a case of updating the installation. In a hosted environment I immediately assumed it would require me contacting 1and1 and getting them to upgrade.
Apparently, one solution requires you to alter the file-extension of all PHP files to .php5, but really - who on Earth would want to do that? Granted, you could do it with a
.bat in a couple of minutes but still it doesn’t seem as elegant as the alternative.
Fortunately, the answer was much more straightforward than that. I quickly discovered from the 1and1 FAQ that in the Linux hosting package you can choose to run either PHP4 or PHP5, with PHP4 running as default. To parse all PHP files within a directly as PHP5 simply requires the editing of the root (to that specific directory)
In altering the
.htaccess, simply add the following line:
AddType x-mapp-php5 .php
Uploading this modified
.htaccess will tell Apache to use PHP5 instead of PHP4 for the extension
.php in the directory the
.htaccess is placed and all sub-directories under it.
.htaccess is a great way to control the configuration of your Apache installation if you do not have direct access to the
httpd.conf or the PHP installation.