Three main applications of PHP
Three main applications of PHP
Server - side scripting -This is the most traditional and main target
the field for PHP are need three things to make this work :-
• The PHP parser CGI or server module.
• a web server -needs a connected PHP installation
• The web browser - Access PHP document pages by URL
Command line scripting -You can run a PHP script without
a server or browser. you only would like the PHP parser to use it this
way. These scripts can also be used for simple word processing
tasks similar to Perl
Writing client-side GUI applications -PHP is probably not the very
the best language to write windowing applications, but PHP.
GTK PHP Graphics Tool Kit can be used to write such programs.
Not addressed in this course.
PHP v Perl
Let's compare Perl and PHP first
Perl :
• interpreted language optimized to process text files - Ideal for
CGI usage .
• using a Perl script as a CGI means that once an online form
Calls to process the script will load the web server of the Perl
script and the output pipe of the script to the user, on the
Web browser .
• simple syntax similar to C
• including advanced functionality through a large number of packets
( CPAN )
PHP v Perl ( Cont. )
PHP:
• Server side scripting language implanted in HTML pages .
• Handled by the web server if the HTML page is loaded.
• PHP code included in special HTML tags that decompose by
the Web server.
• Syntax is different from Perl ( but not much else )
• PHP also has some very advanced features.
The advantages of Perl / PHP
Perl has many advantages:
• general purpose language - functions to do almost anything.
• Perl modules that can be downloaded and loaded into a Perl
script.
• Scripts can also be made to be processed by the web server and
by a user of the shell (NOT WEB-BASED ) , if necessary.
The advantages of Perl / PHP ( Cont. )
PHP also has some advantages :
• it is included in HTML pages .
This means that:
- all your work can be done in the same folder , and
- a single file can contain HTML and PHP code
- much easier to edit / maintenance of web pages.
- This improves tasks such
-Dynamic page processing.
- Checking and doing simple HTML form based on tasks.
- database connectivity
Disadvantages of Perl / PHP• Management of simple scripts is harder than PHP:- Scripts should be loaded individually from the hypertext markup language pages.- typically scripts also be stored in a special folder - eg cgi-lib.pl,scripts, so do not need to load a separate location.• PHP integrates well into HTML files - • If the PHP code complex can lead to a complex• highly suitable for simple dynamic web processing,mixture of code on the page. Disadvantages of Perl / PHP (Cont.) PHP: • Not so great for more complex tasks* Not as general purpose as Perl.- harder to parse / understand and maintain much code mixed with web page (see above). * PHP requires that the server is configured to parse PHP files.they should not be used in files which do not have to be processed.* Perl similar but both now globaly supported. * also, PHP files must decompose by the server at any load, so * Perl similar but both slightly less overhead. Examples of applications of Perl / PHP• heavy database Access / UsageNor PHP or Perl the best for all web tasks: * Horses for courses Perl: heavy CGI calculations, for example, • Search engines, • data processing, • heavy Access File etc. PHP: better suited for dynamic html, such • process simple formE.g. a database-connected simple database connectivity.• creating a complex site integration
0 comments :
Post a Comment