

What is better as a scripting language: PHP-CLI or Python? - gauravgupta

What is better as a scripting language: PHP-CLI or Python?<p>My website already runs PHP for it's UI. I now need to code some scripts which will fetch data from certain URL's on a daily basis, parse the XML it fetches and populate the database with the data it extracts.<p>If PHP 5, with its enhanced object oriented features and rich libraries is on par with Python on the command line, then wouldn't it make better sense for me to use PHP for both web and CLI/GUI development?<p>But, I can't ignore the fact that people do use python almost exclusively for high level CLI/GUI scripting.<p>Which of them is a better choice?
======
racy_rick
PHP CLI is brilliant and once I found out about it writing scripts and cron
jobs became a lot simpler.

I have php scripts that run on the command line that run for long periods of
time. I have also found a lot of ways to reuse code originally written for our
website.

I don't know about memory consumption problems, but I have php scripts that
are coded functionally (not OO) that run for an hour (processing HUGE amounts
of data).

~~~
pkeane
yes -- scripts I have had memory problems with stopped having such problems
when I rewrote them as procedural (not OO) code.

------
pkeane
Although I've heard 5.3 fixes some of the issues, PHP is often not suitable
for long-running scripts due (I believe) to memory consumption (when using OO
code). I believe it is an issue w/ garbage collection of objects.

