How to update my webpage to php 5.3


#1

I wanted to use the function date_diff, which is only available in PHP 5.3. However, it didn’t work so I typed in echo php_version(); and it said 5.2.17. But then I went to manage domains, edit, php mode and it clearly said it was already on “PHP 5.3.x FastCGI (default)”. I changed it to this again but it is still saying the PHP version is 5.2.17. What should I do? Thanks.


#2

the panel setting only determine the php that is used when a page is served via apache. To use a different php from the CLI you must use an explicit path such as /usr/local/php53/bin/php.

See also http://wiki.dreamhost.com/Php#PHP-CLI_.28Using_PHP_from_the_Command_line.29


#3

Thanks! I’ll try this.


#4

If my website is not served via apache then how is it served?

This is confusing stuff and requires that I learn a lot of new things. I am a beginner with web development. I have been studying html, js, and css for the past few months and have barely started PHP. I don’t know anything about how the Internet really works or how a command line could possibly have anything to do with PHP. It’s not worth it for me right now when all I want to do is use slightly more convenient date functions that exist in php 5.3, but not 5.2. If you or anyone could give me step by step instructions to switch my version I would appreciate it. Otherwise I guess I’ll save this for another time!


#5

Are you running your PHP code in a browser via your website or from the commandline in shell?


#6

Thanks for responding…I am running it in a browser. Switching is even more urgent now because Paypal now requires it. Can you tell me how to upgrade to PHP 5.3?


#7

If you have changed the setting in the Panel to PHP 5.3 and you’re still seeing a 5.2 version number in the browser, chances are that you’ve made customizations (or used a script which made customizations) which forced the use of that version. As the details of these customizations can vary, we can’t give any exact directions as to how to remove them; however, chances are that there will be some lines related to them in an “.htaccess” file at the root of your domain. Commenting these lines out (by prefixing them with “#”) or removing them should have the desired effect, but may cause some other PHP configuration changes you’ve made to be lost.


#8

Visual representation: http://sxi.sabrextreme.com/forum/viewtopic.php?id=31


#9

Thanks to both responses…I will try this and get back to you.