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 .php5
to tell it to use PHP 5. More and more web servers these days are set up so that .php
defaults to PHP 5, and the .php5
extension 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 .php
extension 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.
It's usually done so they can run two version of the PHP interpreter on the server and the Apache to parse .php5 files with the PHP 5.x interpreter and .php files with an older PHP 4.x interpreter.
You'd have to check your Apache config to see if this is the case. If this is the case you'd then have to change the config to parse .php files through the PHP 5.x interpreter before renaming the file extension.
Then run the app through it's paces keeping an eye on the error log for new error/notices. I had a similiar experience and found out I had to convert all instance of ereg (which is deprecated in PHP 5) to preg_match.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With