I’ve completely taken over my company’s site and the old developers used PHP5 file extensions. I’ve worked with them for a while, but then wondered why? I’m still somewhat new to PHP, but when I renamed every file from GoDaddy and openned them on my localhost on Ubuntu, the pages loaded normal. So why in the world did the developers use php5 file extensions?
Also to mention, they used bad ways of coding I found out like <?= $code ?> when they should have used <?php echo $code; ?>.
Will I be safe moving the renamed php file extensions over and renaming the “ipn.php5” to “ipn.php” for PayPal?
I know .php5 is a new version and not language, so what’s the point of using .php5 file extensions when I can do all that I want with .php file extensions?
The file extension tells the web server which version of PHP to use. Some web servers are set up so that PHP 4 is the default, and you have to use
.php5to tell it to use PHP 5. More and more web servers these days are set up so that.phpdefaults to PHP 5, and the.php5extension doesn’t do anything extra.In fact, if you have control over the web server you should be able to configure the mapping between file extensions and PHP versions whichever way you want. On shared hosting providers the mapping can’t be changed without affecting other users of the same server.
If the
.phpextension gives you the version of PHP that you require, then go for it. It’s best to keep it consistent across your entire project, however.