How to use separate php version for different php files

Viewed 7016

I have a site (based on ZEND framework) and hosted on 1and1 server.

1and1 server uses PHP version 5.2.17 and 5.4.5. I need to use PHP version 5.4.5 for a few files only. This is because some of my other files show a errors if I use PHP 5.4.5 but they execute fine using PHP 5.2.17.

On my .htaccess file the line below was written earlier to use PHP 5.2.17

AddType x-mapp-php5 .php

To use PHP 5.4.5 I have to use the the line below (instructions to use this code will be found on the 1and1 faq page)

AddHandler x-mapp-php6 .php

FAQ url(s):

Is there any way to use PHP 5.4.5 for those specific files only?

I tried to use the line below in .htaccess, but it's not working:

AddType x-mapp-php5 .php
AddHandler x-mapp-php6 FilenameController.php

EDIT

I tried to edit the 5.2 code. I am using PEAR packages to create Excel sheet which is working fine with PHP 5.2.17 but displaying the error below on PHP 5.4.5

Fatal error: Cannot redeclare _PEAR_call_destructors()

Addendum

This change to the .htaccess file

AddType x-mapp-php5 .php 
AddHandler x-mapp-php6 .php6 
SetEnv APPLICATION_ENV development 
Options -MultiViews 
<IfModule mod_rewrite.c> 
  RewriteEngine On 
  RewriteBase / 

  RewriteRule ^FilenameController\.php$ FilenameController.php6  [L] 

  RewriteCond %{REQUEST_FILENAME} -s [OR]
  RewriteCond %{REQUEST_FILENAME} -l [OR] 
  RewriteCond %{REQUEST_FILENAME} -d 
  RewriteRule ^.*$ - [NC,L] 

  RewriteRule ^.*$ index.php [NC,L] 
</IfModule>

generates 404 "Page not found" error if I change the filename of FilenameController.php to FilenameController.php6 and when I am trying to visit the page its generating.

2 Answers
Related