Solved

new development: PHP or Perl

Posted on 2004-10-10
8
274 Views
Last Modified: 2010-04-06
Hello Experts,

I am starting a new web development and the question is what to choose - PHP or Perl? The site will contain 50+ pages with HTML templates, database - PostgreSQL, webserver - Apache, operating system - Linux. I am curious what is best choice considering time for development, performance with few thousands users simultaneously, support, etc.
0
Comment
Question by:Ivanov_G
8 Comments
 
LVL 5

Expert Comment

by:php-webdesign
Comment Utility
Well... i think both languages have their advantages and disadvantages. About the 1000 users using it simaltaniously, the preformance of you application will still be dependent on the way YOU will write your application.

If you really want to be sure read the following article:

http://www.thesitewizard.com/archive/phpvscgi.shtml
0
 
LVL 5

Accepted Solution

by:
php-webdesign earned 150 total points
Comment Utility
and:

http://php.weblogs.com/php_versus_perl
http://perl.about.com/library/weekly/aa040500a.htm

[quote]
The biggest advantage of PHP over Perl is that PHP was designed for scripting for the web where Perl was designed to do a lot more and can because of this get very complicated. The flexibility / complexity of Perl makes it easier to write code that another author / coder has a hard time reading. PHP has a less confusing and stricter format without losing flexibility. PHP is easier to integrate into existing HTML than Perl. PHP has pretty much all the 'good' functionality of Perl: constructs, syntax and so on, without making it as complicated as Perl can be. Perl is a very tried and true language, it's been around since the late eighties, but PHP is maturing very quickly.
[/quote]
0
 
LVL 2

Expert Comment

by:pmosinskis
Comment Utility
PHP for sure. Integrates with the web environment more easily.
Also tops in terms of performance.

--pete
0
 
LVL 12

Author Comment

by:Ivanov_G
Comment Utility
I made some test 5 time executing 10 mln loops:

  PHP : for ($i=0; $i<10000000; $i++)
          {
            $a = 1;
          }

  Perl : for (my $i=0; $i<10000000; $i++)
          {
            my $a = 1;
          }

Perl
  3.914818 s
  3.574317 s
  3.604372 s
  3.754552 s
  3.584347 s

Php
  5.13295507431 s
  5.14524912834 s
  5.19279384613 s
  5.30360507965 s
  5.20312786102 s

It seems that Perl is faster...
0
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 18

Expert Comment

by:arantius
Comment Utility
That's a relatively poor test, it concentrates on one tiny thing (assigning value to a variable).  You were also probably running scripts (at least perl) from the command line rather than web server environment.

I would say PHP hands down.  Technically Perl can be a bit faster, but coding technique has significantly more impact than programming language.  Development time, though, will be significantly lower with PHP, as it is designed for the task.  PHP does web pages, and well.

If performance is an issue, there are free and commercial optimizers that claim (and show benchmarks) for 10 or more times speed increase.
0
 
LVL 12

Author Comment

by:Ivanov_G
Comment Utility
I ran the tests from a web page... It shows that PHP is slower ... I don't know why. The top issue here is the performance...
0
 
LVL 2

Assisted Solution

by:Adesso21
Adesso21 earned 100 total points
Comment Utility
PHP might be a bit slower.. but may a suggest something that you should rather be looking at.. MySQL instead of PostgreSQL

In due time you will have a rather large DB structure and if you choose rigth now.. that will not become a problem later..

If you want to have a test .. try this .. PHP script and see if you can make your server crash..

Just make a DB with one table MDtable that has an Auto incrament ID and a varchar(255) field

Then see if you can do the same in perl.. in essance this is the diffrence between PHP and Perl.. PHP is much faster to develop  and easyer to understand..

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Nail the server</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style>
      DIV {
            border : 1px solid black;
            width : 800px;
      }

</style>
</head>
<body>
Attempting to crash the server with too many records.. <br>

<?
set_time_limit(8000000000);
function open_db() {
        $db = "nail";
            $dbuser = "{username}";
             $dbpass = "{pass}";
            $dbhost = "{host}";
      if (!isset($link)) {
            $_SESSION['link'] = mysql_connect ($dbhost,$dbuser,$dbpass) or die ("Error: Could not connect.");
            mysql_select_db ($db) or die (print_r($_SESSION)."Error: Could not select database: $db, $dbhost, $dbuser, $dbpass");
      }
}

function close_db() {
      if (isset($link)) {
            mysql_close($link);
      }
}

function timenow() {
      $today = getdate();
      $hours = $today['hours'];
      $minutes = $today['minutes'];
      $seconds = $today['seconds'];
      
      $newtime = $hours.":".$minutes.":".$seconds;
      return $newtime;
}
?>
<div>
<?
$startTime = timenow();
for($i=0; $i < 1000000; $i++) {
      print "+ \n";
      for($j=0; $j < 1000000; $j++) {
            $MDstr = md5(timenow());
            open_db();
                  $Qinsert = "INSERT INTO MDtable VALUES(NULL,'$MDstr');";
                  mysql_query ($Qinsert) or die("$Qinsert \n\n");
            close_db();
            print ". ";
      }
      print " ";
      flush;
}
?>
</div>
<?
$endTime = timenow();
print "<br><br><strong>started</strong> $startTime";
print "<br><br>Added <strong>".$i*$j."</strong> records";
print "<br><br><strong>ended</strong> $endTime";
?>
</body>
</html>

0
 
LVL 12

Author Comment

by:Ivanov_G
Comment Utility
Adesso21, I agree that PHP will have less development time, but what I want is top performance. Since Perl seems faster, I will choose it...

About the DB - MySQL vs. PostgreSQL - there are a lot of articles on this issue. Postgres offer more functional SQL language with sequences, stored procedures, triggers, etc. The new versions of PostgreSQL are not so slow... In fact the performance is almost the same as MySQL transactional tables.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
remove Handler and Add Handler for one file 3 31
RSS feed not showing item time 3 16
RSS Feeds--IE 13 150
Problem to picture file 3 37
Shoutout to Emily Plummer (http://www.experts-exchange.com/members/eplummer26.html) for giving me this article! She did most of it, I just finished it up and posted it for her :)    Introduction In a previous article (http://www.experts-exchang…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now