Current Mood:
Sedimentary
I spent the weekend coding in PHP, mostly because it had been a little while since I used it. It was kind of an attempt to shake of the little bit of rust that had developed while I was sitting happily in Python world. It didn’t take long for me to remember why I kind of actually hate PHP. It has replaced Perl in my brain as the “goofy” language. PHP had a good start, it was a simple HTTP Pre-processor. Unfortunately it grew up into quite the ugly beast.
I originally thought my troubles would be in re-training my fingers to use the C-style coding. You know, things like ending lines of code with a semicolon, encapsulating conditional clauses in parenthesis. Easy stuff. None of that was too big of a deal. The part that had me tearing my head out was PHP’s complete infancy when dealing with strings. Seriously. They are stuck in a world where multibyte strings are the exception rather than the rule. This seems especially odd, considering that HTML is supposed to be the primary ‘language’ that PHP is outputting (hint: HTML-ENCODING is a multibyte encoding).
Instead of ranting and raving I was gonna give a detailed example of my frustrations with the fact that in PHP iterating over a string is even more complicated than it needs to be, and the fact that multibyte handling seems to be a hacked on patch rather than what one would call “fully implemented”. I won’t though, cause that would basically be like going through all that pain a second time. I’m not that dumb.
I’ll just have to take comfort in the knowledge that I’m not the only soul on earth forced to go between langauges, and take solace in the company.

Monday, 10. November 2008
Don’t even get me started on the “need” for === in PHP.
Monday, 10. November 2008
I pick up PHP every here and then as a “I should learn this” kind of thing. However, I inevitably get bored with whatever small project I chose to do and promptly forget everything again. I’ve reached a point that I don’t really have any desire to learn it anymore. Know of any good python web frameworks?
Monday, 10. November 2008
No I don’t. What the hell is a ‘web framework’ anyways? Does that mean it outputs html well? Use a templating system. Does that mean it parses HTTP request parts well, like GET and POST variables and HTTP headers and such? Python has modules that do all this. Does it mean being built into apache?
This is my problem with PHP at its core. It requires no actual knowledge of what you are doing, on any level. You shouldn’t be able to use PHP to write web pages before knowing HTTP and HTML on at least a basic level.
Monday, 10. November 2008
*See bad blog trend #2.
Tuesday, 11. November 2008
Actually I’m glad you wrote that because it is quite a handy quick reference for me now. Thank you.
Tuesday, 11. November 2008
if you cant stand the head, keep out of the cookie jar
Tuesday, 11. November 2008
I would think it would still be quite difficult to write PHP web pages without some knowledge of HTTP and HTML, or at least a web page with any functionality. Maybe PHP has abstraction layers that I never got into. Like I said, I always promptly forget it after playing with it for a bit.
As to what I consider a web framework: yes, yes, and kind of. I’ve used things like CherryPy, but it’s obnoxious because it runs its own http server. I don’t want yet another http parser, I’d prefer something that runs through an apache module. Really, I was just curious if there was a python (or any other) setup you liked for web apps.
Tuesday, 11. November 2008
MMMM PIE
Tuesday, 11. November 2008
It’s been a few months since I’ve written something in PHP or ASP; I’ve been busy writing software in C# and Python, and I kind of hope it stays that way. You mention all the valid complaints about PHP, and the only real attraction for me to write web things in it nowadays is because while it has it’s problems (add the entire php-mysqli library to your list), at least it’s not as excessively convoluted as ASP. I’ve not yet had a project in which I had a choice as to which language to write for the web in, but I’m hopeful about using Python in the future.
desterttrail may have been referring to a framework in the ‘Rails’ is to Ruby as ‘Django’ is to Python. These typically tie in all the components of basic web development (application logic, database code, source control, pre-made functionality packages, etc). These however further exasperate the issues that were mentioned in this blog post, since it effectively means there is no knowledge requirement for the protocols and dbms involved. There’s a certain amount of danger involved with giving powerful (yet restricting) tools to those who aren’t familiar with what they do on a deeper level. This is what usually leads to security problems like SQL injection and XSS vulnerabilities.
Anyway, if you are interested, there have been attempts to make decent ones for PHP, including a virtual straight-over port of Rails called “PHP on Trax”.
Wednesday, 12. November 2008
Sometimes when I pet a cat I make fart noises.