f-w-r
09-01-2002, 06:25 AM
What language is the easiest to learn PHP, or CGI. Is their a large difference between the two languages. Also which one do you think is better?
I'm intererested in putting a topsite toplist on the main page of my website.
Thanks guys for your comments, in advance.
ho247
09-01-2002, 06:44 AM
PHP is definitely easier to learn than CGI/Perl. I used to always code in Perl, but then got interested in PHP and started to do all coding in PHP/MySQL. Both languages are more or less the same, you'll find function names are either the same or similar. If you want a top list script, you could try HotScripts.com (http://www.hotscripts.com/), they'll have a list of the many top site scripts available on the web for free (that's if you don't really want to learn a language).
Alan
dynamitehost
09-01-2002, 06:48 AM
I used to code perl untill I found out about php.
php is definately easier to code, its nearly the same but has less - to put it bluntly - crap.
You could code your own php/mysql top sites list within 2 - 4 weeks of learning some php. I did it :D
Lawrence
09-01-2002, 09:30 AM
I think most people tend to agree that PHP is easier to learn than Perl (note that CGI isn't a language, it's an interface, and you can run PHP under CGI if you want, but I assume you mean Perl, as it is most commonly run under CGI). Perl is more versatile than PHP, however, and is commonly used for many other tasks beyond web development as well.
If you're just interested in web development, PHP is probably the way to go. If you're looking longer term to get into programming, Perl is perhaps a better choice.
hosthero
09-01-2002, 10:02 AM
PHP is definately easier.
Walter
09-01-2002, 10:46 AM
CGI is no language, wonder what you mean...
Acronym BOY
09-01-2002, 12:06 PM
Originally posted by Darth
Cgi = Perl
cgi != perl :rolleyes:
CGI stands for "Common Gateway Interface".
What language are CGIs written in? Almost any scripting or programming language, although of course the language has to be one which runs on your Web server's platform. The most common language for creating CGI scripts is Perl (stands for "Practical Extraction and Report Language" -- sound like something your dentist would enjoy?). Perl is a very flexible and powerful language and is especially good at handling text (doing sophisticated search and replace with wildcards, for example). It also has the advantage of running on all platforms (sometimes requires small modifications to port form one system to another). I like to try out new Perl scripts on my Mac Powerbook, where I can run both server and browser locally, then upload the script to the university Unix server once it's working. That way I can get the bugs out before crashing the university's server.
Another cross-platform option is C or C++, a complex programming language whose learning curve is probably prohibitive for folks who want to have a family life. However, if you have the time and ambition, C will offer the best performance in CGI's. On Windows Web servers Visual Basic (VB) is often used for CGI's. If you're worked in VB already, this is clearly the way to go, if not it may not be as good a choice as Perl if you're thinking in terms of educational use where you'll likely be doing a lot of text parsing and processing. There are a good number of VB scripts available off the Internet as well as scores of books. Microsoft is the patron of VB so it is likely to be around for a while. In fact Microsoft has introduced VBScript as a competitor to JavaScript. VB does not run on Unix or Mac servers.
On Mac servers a variety of languages are used, most commonly AppleScript and Frontier. Of all the possible CGI languages AppleScript is the easiest to learn. As compared to Perl or C you can actually read and understand most scripts written in AppleScript. The commands actually look like English (rather than cryptic geekspeak). By the way, there are versions of AppleScript for many different (human) languages. So you could write your AppleScript CGI in French or Spanish. You can pick up AppleScript especially quickly if you're worked at all in HyperCard or Toolbook -- the syntax is very similar. As matter of fact you can also use HyperCard to write your CGI's; versions 2.0 or higher allow you to write your scripts in Hypertalk or AppleScript.
Another popular CGI choice on Mac servers is Frontier. Frontier has a steeper learning curve than AppleScript, but it runs faster, has more built-in functionality, and is multi-threaded. Multi-threaded means that the CGI can service more than one user at the a time. Otherwise a new user must wait until the CGI is done with its current user. This is actually in most cases not as big an issue as it may sound. Most CGI's execute in a couple of seconds; the ones which take longer are probably writing data to a log file or database, operations which normally can only happen one user at a time. Frontier is also now available for Windows.
Haley
09-01-2002, 12:28 PM
PHP is easier to learn. There are many free scripts also available on the net.