Friday, October 31, 2008

PHP

Preface
PHP, which stands for "PHP: Hypertext Preprocessor" is a widely-used Open Source general-purpose scripting language that is especially suited for Web development and can be embedded into HTML. Its syntax draws upon C, Java, and Perl, and is easy to learn. The main goal of the language is to allow web developers to write dynamically generated web pages quickly, but you can do much more with PHP.


This manual consists primarily of a function reference, but also contains a language reference, explanations of some of PHP's major features, and other supplemental information.
You can download this manual in several formats at
» http://www.php.net/download-docs.php. More information about how this manual is developed can be found in the 'About the manual' appendix. If you are interested in the history of PHP, visit the relevant appendix.

Authors and Contributors
We highlight the currently most active people on front page of the manual, but there are many more contributors who currently help in our work or have provided a great amount of help to the project in the past. There are a lot of unnamed people who help out with user notes on manual pages, which continually get included in the references, the work of whom we are also very thankful for. All of the lists provided below are in alphabetical order.


Authors and Editors
The following contributors should be recognized for the impact they have made and/or continue to make by adding content to the manual: Bill Abt, Jouni Ahto, Alexander Aulbach, Daniel Beckham, Stig Bakken, Jesus M. Castagnetto, Ron Chmara, Sean Coates, John Coggeshall, Simone Cortesi, Markus Fischer, Wez Furlong, Sara Golemon, Rui Hirokawa, Brad House, Pierre-Alain Joye, Etienne Kneuss, Moriyoshi Koizumi, Rasmus Lerdorf, Andrew Lindeman, Stanislav Malyshev, Rafael Martinez, Rick McGuire, Yasuo Ohgaki, Derick Rethans, Rob Richards, Sander Roobol, Egon Schmid, Thomas Schoefbeck, Sascha Schumann, Dan Scott, Masahiro Takagi, Michael Wallner, Lars Torben Wilson, Jim Winstead, Jeroen van Wolffelaar and Andrei Zmievski.
The following contributors have done significant work editing the manual: Stig Bakken, Gabor Hojtsy, Hartmut Holzgraefe and Egon Schmid.



What can PHP do?
Anything. PHP is mainly focused on server-side scripting, so you can do anything any other CGI program can do, such as collect form data, generate dynamic page content, or send and receive cookies. But PHP can do much more.
There are three main areas where PHP scripts are used.
Server-side scripting. This is the most traditional and main target field for PHP. You need three things to make this work. The PHP parser (CGI or server module), a web server and a web browser. You need to run the web server, with a connected PHP installation. You can access the PHP program output with a web browser, viewing the PHP page through the server. All these can run on your home machine if you are just experimenting with PHP programming. See the
installation instructions section for more information.
Command line scripting. You can make a PHP script to run it without any server or browser. You only need the PHP parser to use it this way. This type of usage is ideal for scripts regularly executed using cron (on *nix or Linux) or Task Scheduler (on Windows). These scripts can also be used for simple text processing tasks. See the section about
Command line usage of PHP for more information.
Writing desktop applications. PHP is probably not the very best language to create a desktop application with a graphical user interface, but if you know PHP very well, and would like to use some advanced PHP features in your client-side applications you can also use PHP-GTK to write such programs. You also have the ability to write cross-platform applications this way. PHP-GTK is an extension to PHP, not available in the main distribution. If you are interested in PHP-GTK, visit
» its own website.
PHP can be used on all major operating systems, including Linux, many Unix variants (including HP-UX, Solaris and OpenBSD), Microsoft Windows, Mac OS X, RISC OS, and probably others. PHP has also support for most of the web servers today. This includes Apache, Microsoft Internet Information Server, Personal Web Server, Netscape and iPlanet servers, Oreilly Website Pro server, Caudium, Xitami, OmniHTTPd, and many others. For the majority of the servers PHP has a module, for the others supporting the CGI standard, PHP can work as a CGI processor.
So with PHP, you have the freedom of choosing an operating system and a web server. Furthermore, you also have the choice of using procedural programming or object oriented programming, or a mixture of them. Although not every standard OOP feature is implemented in PHP 4, many code libraries and large applications (including the PEAR library) are written only using OOP code. PHP 5 fixes the OOP related weaknesses of PHP 4, and introduces a complete object model.
With PHP you are not limited to output HTML. PHP's abilities includes outputting images, PDF files and even Flash movies (using libswf and Ming) generated on the fly. You can also output easily any text, such as XHTML and any other XML file. PHP can autogenerate these files, and save them in the file system, instead of printing it out, forming a server-side cache for your dynamic content.


One of the strongest and most significant features in PHP is its support for a wide range of databases. Writing a database-enabled web page is incredibly simple. The following databases are currently supported:
Adabas D
dBase
Empress
FilePro (read-only)
Hyperwave
IBM DB2
Informix
Ingres
InterBase
FrontBase
mSQL
Direct MS-SQL
MySQL
ODBC
Oracle (OCI7 and OCI8)
Ovrimos
PostgreSQL
SQLite
Solid
Sybase
Velocis
Unix dbm We also have a database abstraction extension (named PDO) allowing you to transparently use any database supported by that extension. Additionally PHP supports ODBC, the Open Database Connection standard, so you can connect to any other database supporting this world standard.
PHP also has support for talking to other services using protocols such as LDAP, IMAP, SNMP, NNTP, POP3, HTTP, COM (on Windows) and countless others. You can also open raw network sockets and interact using any other protocol. PHP has support for the WDDX complex data exchange between virtually all Web programming languages. Talking about interconnection, PHP has support for instantiation of Java objects and using them transparently as PHP objects. You can also use our CORBA extension to access remote objects.
PHP has extremely useful text processing features, from the POSIX Extended or Perl regular expressions to parsing XML documents. For parsing and accessing XML documents, PHP 4 supports the SAX and DOM standards, and you can also use the XSLT extension to transform XML documents. PHP 5 standardizes all the XML extensions on the solid base of libxml2 and extends the feature set adding SimpleXML and XMLReader support.
At last but not least, we have many other interesting extensions, the mnoGoSearch search engine functions, the IRC Gateway functions, many compression utilities (gzip, bz2, zip), calendar conversion, translation...
As you can see this page is not enough to list all the features and benefits PHP can offer. Read on in the sections about
installing PHP, and see the function reference part for explanation of the extensions mentioned here.

http://tr2.php.net/manual/en/intro-whatcando.php

Wednesday, October 22, 2008

ASP

So you have seen and heard about ASP on the web, and now you wonder what it is, and what it can do for you. Well, Microsoft introduced Active Server Pages in December 1996. Microsoft made it available for its Internet Information Server (IIS), beginning with Version 3.0. It is an open technology framework, comprised of several different commonly used programming disciplines. It makes it easy to integrate heavy programs and databases to web pages. At the core of ASP we find VBScript. It acts as a glue to combine all the power ASP into your web pages, and often when people speak of ASP and ASP code, they really mean VBScript code. VBScript is the default script language in ASP, but you can use Perl, JScript etc. ASP is run server side, meaning that the script is run on the web server, so that the webpage functions regardless of browser (it generates clean HTML). In May 2000 Microsoft estimated that there where over 800.000 ASP developers in the world, making Active Server Pages a high-growth technology. At the same time they estimated that over 500 companies was producing ASP components and applications covering functionality from accounting and electronic commerce to mainframe and other legacy data access. What can it do?Everything! Almost. The possibilities are endless, but some key uses are creating webpages based on database searches, personalized pages, display of different pages for different browsers, online shops, password protection, games and form processing.

Take a look!This is some samples to show you what you can do with ASP.
VBScript chat (Lesson 2)
Othello game (VBScript code archive)
Simple password protection (VBScript code archive)

What do I need to start?To get the full power and all the features of ASP, you need a MS Windows NT 4.0 machine with IIS 4.0 (IIS 4.0 is a free upgrade to NT included in the NT 4.0 Option Pack) or Windows 2000 Server (IIS 5.0). You can also install a light version of ASP on your Win95/Win98/WinME machine with PWS (Personal Web Server, you can find PWS on the Windows 98 CD-ROM or download it from Microsoft.com, it's included in the NT 4.0 Option Pack) If you run on a UNIX flavour, or for some reason don't want IIS, you can buy ChiliASP. The easiest way to publish ASP pages are getting NT/Win2000 hosting. To find a hosts you should check out HostIndex. If you want to check out free hosting check out this updated list of free hosts from ASPCode.net. (Please note the you should never have a serious or critical site hosted on a free host.) To write the code, you only need a text editor like Notepad, Emacs or EditPad. What is the future of ASP? Microsoft is developing a new version of ASP as a part of it's new .NET product range called ASP.NET (previously called ASP+). To learn more about ASP.NET read this free sample chapter from the book Introducing .NET. Good luck!