tags:

views:

89

answers:

2

Is there any drawback to this setup?

I want to be able to run PHP5 filters and functions... Will renaming a file to something.php5 allow me to do this?

My hosting provider suggested this instead of upgrading to PHP5. The default is still php4 with registered_globals ON

+2  A: 

Changing the file extensions won't change the version of PHP that's installed on the server. If your host only has PHP4 then you can only use PHP4 unless they're willing to give you PHP5. The only way this will work is if your host already has PHP5 running and has it setup to only work with files that have the .php5 extension (this is an entirely possible scenario).

I'd say the first thing to do is to create a simple phpinfo file, like below, and name it with the .php5 extension and see what it says.

<?php
  phpinfo();
?>

phpinfo() will give you the PHP version in big bold text at the top of the file. So if a file with .php says it's PHP 4.x and a .php5 file says its PHP 5.x, then your host has both installed on the server and is telling Apache to use PHP5 with .php5 files and PHP4 with .php files.

And on a side note if your host has register_globals turned on and they won't turn them off, I'd recommend putting the following in a .htaccess file at your document root.

php_flag register_globals off
Steven Surowiec
Could you then help me understand what my hosting provider could mean by "change scripts extension to .php5 for php 5 execution. Default .php will still be for php4 and compatability?"
chris
I've updated my answer with some more information. Sorry for the multiple edits.
Steven Surowiec
thank you very much for the explanation. The host must indeed have php5 and 4 installed as phpinfo() with a .php5 extension does come back as php version 5
chris
+1  A: 

Are you allowed to rewrite those settings per directory with a .htaccess file?

If you can, just ask you hosting provider how the setting is made and change it just for you. Something like

Action application/x-httpd-php /path/to/php5
p4bl0