You are here: Re: paring large files - PHP or Perl « PHP « IT news, forums, messages
Re: paring large files - PHP or Perl

Posted by Daniel Bowett on 09/29/82 11:08

Jamie Alessio wrote:
>>> I'm a great believer in using the right program for the right job. I
>>> need some advice from people who use both PHP and Perl. I've long been
>>> a fan of PHP and we use it for all our development work. However, I seem
>>> to keep coming up with a bit of a problem when using PHP and I just
>>> wanted to see if I was right or if there's something I'm not doing
>>> right.
>>>
>>> Basically, we are bringing emails in from a client that all contain
>>> large files - usually between 12mb and 15mb in size. This side of what
>>> we are doing cannot be changed unfortunately. When we use PHP to parse
>>> these files it often times out - I understand that we can flush data and
>>> we call set_time_limit() occassionally to reset the time counter, but
>>> PHP really seems to struggle. It just seems that every job I work on
>>> that needs to parse large files or do something like web crawling that
>>> we always come across these problems. A couple of people have said that
>>> we should look at Perl because it is better at this kind of thing and
>>> thats why I'd be interested in opinions about it from people who know -
>>> ie those who regularly code in both
>>>
>>> Appreciate any comments or suggestions or even if you can point me to
>>> any sites that cover this as I looked and couldn't find any
>>
>>
> John,
> I second Richard's opinion that there isn't any great reason to ditch
> PHP in favor of Perl if you're already comfortable with PHP and
> especially if you already have working code written in PHP. Are you
> running these PHP scripts from the command line or via a web server? In
> either case just do 'set_time_limit(0)' like Richard suggested and that
> will eliminate the script timeout problems.
>
> It's not really fair to say that PHP isn't a good tool for the job
> because it is timing out. PHP's default setup includes a script timeout
> because it is typically used to serve up web pages in times measured in
> fractions of a second. So, for the vast majority of users something has
> generally gone horribly wrong if a script is running for upwards of 30
> seconds. Your usage of the language is outside what the "typical" user
> does, so the default timeout settings are not appropriate for you. Perl
> does not have any script timeout built in by default so it's not going
> to have that problems. So, just because PHP's default settings don't
> match your needs that does not mean that it isn't an appropriate tool
> for the job.
>
> The bigger factor to consider in your choice of language is the
> libraries available to help get the job done quickly without writing a
> ton of code yourself. In many cases Perl's CPAN library
> (http://cpan.org) has more mature options for doing things like parsing
> email so that might get you up and running faster than with PHP. That
> said, there are some things in the PEAR library that might help. Take a
> look at the Mail_Mime class (http://pear.php.net/package/Mail_Mime).
>
> - Jamie
>
PHP or Perl??? I'd say Python :)

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация