PDA

View Full Version : PHP4 vs PHP5


jdcfsu
2008-10-19, 20:59
My server is currently running PHP4 though I have an option to upgrade it to PHP5. I know nothing about PHP other then how to call WordPress variables using it. If I upgrade to PHP5 will that affect anything on my site? Is there any added benefits to moving to PHP5? Thanks guys.

Brad
2008-10-19, 21:03
Unless you're a programmer and you're writing your own code or you have software that specifically requires PHP5, you probably shouldn't make the upgrade. PHP5 has some vast differences over PHP4, most notably in its object model, but that's nothing that will help old software written for PHP4. In fact, upgrading may cause problems in older software due to the changes in how certain functions behave.

Jerman
2008-10-19, 21:15
What version of WordPress are you running? If it is the latest I would *think* you would be okay. I am just a casual developer, so someone else will probably have to give you a better answer.

What is your site comprised of? IF it is just WordPress, I really think you would be fine. I switched to PHP5 quite awhile back, and it worked fine, even though most of my site is hand-coded. (But admittedly basic. Once I upgraded I began many of the features of PHP 5)

***Edit***

Brad mentions the issue of older software. If you do take the plunge, you want to make sure you have upgraded to the last version of WordPress first.

scratt
2008-10-19, 21:46
It's not clear from your post if you are actually running this server online or not... PHP4, and even PHP5 (up to quite recent versions) is chock full of security holes...

From that POV, IMO it's always a good idea to keep PHP as up to date as possible.

And as Jerman says, upgrade WordPress etc. to suit.

WordPress also when not kept up to date is massively insecure.

jdcfsu
2008-10-19, 21:56
This is an online shared hosting server. My WordPress is constantly up to date. I don't really run anything else besides WP on that server, nothing that requires PHP at least.

scratt
2008-10-19, 22:09
FWIW, and I am no expert on PHP, as some of my posts in the Programmers Nook will attest to, my new server which I just setup from scratch is running the latest version of PHP5 with IonCube, and the latest version of WordPress and all is good in the world. :)

jdcfsu
2008-10-19, 22:27
I just realized my host has PHP3, PHP4, and PHP5 installed on the server but defaults the .php extension to PHP4. With a little .htaccess modification you can pick which version you want to default to. Just switched things and everything is running fine. So I guess that answers that.

Curious though, other than security plugs and a different object model, whatever that is, are there any big differences between the two or is it like each new version of HTML/CSS in that there's just new attributes and class styles?

scratt
2008-10-19, 22:36
Curious though, other than security plugs and a different object model, whatever that is, are there any big differences between the two or is it like each new version of HTML/CSS in that there's just new attributes and class styles?

Brad's your man on that. :)

My experience is only in patching scripts that already exist, and getting it all to run together on servers as securely as possible.

The only stuff I know about is pretty much what Brad has said already (albeit in less detail I am sure), and the fact that some interim 'quick-and-dirty' security fixes like default PHP Safe Mode are in the later versions.

Brad
2008-10-19, 23:53
Curious though, other than security plugs and a different object model, whatever that is, are there any big differences between the two or is it like each new version of HTML/CSS in that there's just new attributes and class styles?

PHP is a programming language; it enables you to write and run web apps on a server. HTML and CSS are markup languages; they simply format static information for display on your screen. It would be nigh impossible to draw a comparison between PHP and HTML/CSS and their version changes. :)

The changes to PHP between 4 and 5 allow for completely different programming methodologies. PHP5 makes strides in becoming a more object-oriented language as well as including a number of default extensions that weren't in PHP4. The concrete differences between PHP4 and PHP5 are better enumerated elsewhere on the web, such as this page (http://devzone.zend.com/article/1714-Whats-New-in-PHP-5) or this page (http://www.webmaster-talk.com/357590-post1.html).

Granted, PHP5 came out five years ago in 2003 and it's positively dumbfounding that web hosts still offer PHP4 as the default. :p That said, The PHP dev team continues to support PHP4 with bugfix and security patches; PHP 4.4.9 was just released in August. So, as long as you're running the latest version of PHP4, you should be fine WRT security.

scratt
2008-10-20, 00:26
WRT to security, it was my understanding that 4 leaves a lot more up to the script programmers when it comes to protecting against SQL 'Injection attacks', whereas 5 has PDO.

I do not know if this is applicable to WordPress, although obviously it does use SQL.