what is the diff between perl and PHP

Chooco

Banned
Apr 5, 2002
731
0
0
Perl has to be in the CGI-BIN but PHP does not, they are both like C++ combined with HTML, they can both access SQL and they both create HTML files based on whatever values it found.
what is the difference between them besides the CGI thing?
 

joinT

Lifer
Jan 19, 2001
11,172
0
0
they are different scripting languages...

the syntax is a little different - but both could accomplish pretty much whatever you're trying to do.
AFAIK, Perl scripts need to be run from the CGI-bin to make them executable ?
& PHP, you need to allow your server to execute php4.exe or whatever...
 

toegristle

Junior Member
May 8, 2002
2
0
0
the main thing i like better about php is that its an embedded scripting language. the php files can contain both the html and the php intermixed however you want to code it.

with perl you can accomplish the same thing with server side includes, but its still a matter of connecting all the html pages to the scripts in the cgi-bin. passing variables or making variables global to all files can be overly complicated in perl, if you are working on a web app with multiple files.

personally i find it much more efficient to have it all in one place. mostly an organizational preference, i guess. if its just a one shot script perl is great, but if you are building web apps i think php is just geared more specifically for that kind of thing. it has session management and database functions built in. you can basically do the same things but with less code.

 

kt

Diamond Member
Apr 1, 2000
6,032
1,348
136
built-in session management is only available with PHP version 4 or later. PHP is not always great for web apps. if you need to do some complex web apps, then perl would be a lot more suitable.
 

DocDoo

Golden Member
Oct 15, 2000
1,188
0
0
Would also like to add...

For certain type of scripts CGI is more secure (like and upload cgi script). I mostly use PHP for generating and CGI for everything else (70/30).

As for CGI scripts needing to be in the CGI-BIN directory, that depends on the webserver. On my server I can call CGI scripts from anywhere under my HTML directory. Another point about CGI security...on some server you can have a CGI-BIN folder that is not in the WEB PATH and only the server can make calls to it (making it impossible to access scripts since they are not in the port 80 path). You can even secure PHP scrips like config.php or admin.php (that could contain SQL and other passwords) when using a "non-html-path" CGI-BIN folder.

Bottom line, PHP is more friendly...
 

Nothinman

Elite Member
Sep 14, 2001
30,672
0
0
You can run php in cgi fashion if you want, Debian has packages setup both ways (php4 and php4-cgi).
You can have perl be run 'inside' Apache like php with mod_perl.

Perl is an all-purpose scripting language with modules for everything (check out cpan), it just happened to do web scripting well because of it's easy text manipulation.
php was designed specifically for web scripting