Question

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.

Was it helpful?

Solution

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

OTHER TIPS

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
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top