Hari's Corner

Humour, comics, tech, law, software, reviews, essays, articles and HOWTOs intermingled with random philosophy now and then

PHP troubles

Filed under: Site management by Hari
Posted on Mon, Nov 11, 2013 at 10:42 IST (last updated: Mon, Nov 11, 2013 @ 10:50 IST)

Setting an updated PHP version on this site has led to some strange effects on this blog. Like the non-display of some pages. Unfortunately PHP is a really unstable language that keeps changing its behaviour on every update. Many functions become deprecated over time, a few change their behaviour and yet others fail silently. The worst part is that, unless you enable error reporting globally, it is very difficult to track down the source of subtle bugs caused by these. 

I have now reverted the server-type to the older version of PHP on my web host so that the site continues working normally as before.

I coded the back end for this blog in 2008 and made a complete move to the new software from b2evolution back then, so the code is slightly long in the tooth. But I cannot understand how such a widely used, popular web development language like PHP can be so unstable from version to version, made worse by the fact that some language features are dependent on the configuration settings in php.ini. There ought to be long-term API stability in a language like PHP.  I hate having to update my code for every major (or even minor) revision of PHP. Thank god for web hosts who recognize this and give uers the option of earlier versions.

2 comment(s)

  1. I know it's frustrating, but PHP is still maturing, and PHP software from 2008 was primarily short-sighted and built with the web in mind. With the web changing so rapidly and developers coupling their code to the web, it's no wonder things break. A web-decoupled and test-covered codebase will not run into these issues.

    As for global error reporting - don't! Just make sure your error logging is on. Also use loggers within your code for custom exceptions.

    Comment by Dion Moult (visitor) on Mon, Nov 11, 2013 @ 12:28 IST #
  2. I know it's frustrating, but PHP is still maturing, and PHP software from 2008 was primarily short-sighted and built with the web in mind. With the web changing so rapidly and developers coupling their code to the web, it's no wonder things break. A web-decoupled and test-covered codebase will not run into these issues.


    I agree that the web is constantly changing. But the PHP language should at least have a stable API with fewer run time configurable functionality with additional features added on in modules. The current global function list is a mess, in my opinion. And since the behaviour of some function calls is so dependent on php.ini, it makes it hard to make code work as expected on a slightly different set up. It requires a lot of workarounds and checks.

    As for global error reporting - don't! Just make sure your error logging is on. Also use loggers within your code for custom exceptions.


    I know. I am wary of enabling global error reporting. I will look at how to set the error logging at the PHP level on my web host.

    Comment by Hari (blog owner) on Mon, Nov 11, 2013 @ 13:01 IST #

Comments closed

The blog owner has closed further commenting on this entry.