Python vs PHP

Afanasiy abelikov72 at hotmail.com
Tue Jul 8 17:56:58 CEST 2003


On Mon, 07 Jul 2003 13:47:00 +0300, Catalin <ady982 at ploiesti.astral.ro>
wrote:

>Can Python replace PHP?
>Can I use a python program to make an interface to a mysql 4.X database?
>If that's possible where can I find a tutorial?
>

I recommend Spyce, Webware, or Quixote depending on your requirements,
but Draco, SkunkWeb, RoadKill are worth looking into as well. Spyce is
really the best (for PHP-ness) in my opinion, after you actually get past
the fact that it supports your old fashioned notion of what embedded
delimiters should look like, as well as a new CTS-friendly alternative.

Spyce is the closest thing to PHP, but also provides some features PHP
does not. However, I think you will find some people, like myself, who are
still unable to make the switch from PHP to Python for web development,
because of a lot of little things. These people know Python is better and
may even know their non-web PHP applications are hell compared to their
Python re-implementations. However, they still use PHP for web development
and feel they have to. They may have even written out all the requirements
and received vague responses to them.

Python web development is fragmented. Mod_python CVS now contains the work
of what used to be mod_psp by Sterling Hughes, a PHP warlord, I'm sure
he'll reply. This possibly soon to be official 'PSP' is not much in my
opinion and should probably not be folded into mod_python. Others agree:

http://www.modpython.org/pipermail/mod_python/2003-June/003200.html

Another big problem with Python web development is the lack of good shared
hosting support. Primarily the lack of anything resembling PHP's safe
mode. Mod_python has no equivalent of this safe mode, but Apache 2's
'Perchild MPM' is supposed deprecates this need. However, this still
requires an httpd.conf edit and a restart of Apache for every user added,
very annoying, especially to a shared hosting service.

http://apache.slashdot.org/apache/02/12/02/1346206.shtml?tid=
http://httpd.apache.org/docs-2.0/mod/perchild.html
http://www.modpython.org/pipermail/mod_python/2001-November/001705.html

A couple other slight issues :

* catch-all error handling not as flexible or non-existent
* no equivalent to php_value auto_prepend_file "_header.php"
* no equivalent to php_value auto_append_file "_footer.php"
* not as intelligent form value handling
* white space sensitivity is a unique problem when embedding

The best options for me are currently :

* use PHP
* use Spyce
* fork Spyce (creating more fragmentation)
* embed python straight into my favorite platform (quite funny)
* write my own mod_python-based platform (more fragmentation)
* find the holy grail (i must have missed it)

I've been handling this dilemma for months. I've even benchmarked quite a
few possible solutions, with pleasing results in those which I thought
were well done, and pleasing results for Python over PHP in general.

-AB




More information about the Python-list mailing list