PHP MySql Tutorial Learning PHP is a computer scripting language. Originally designed for producing dynamic web pages, it has evolved to include a command line interface capability and can be used in standalone graphical applications

Monday, September 22, 2008

Function PHP

Its syntax and its construction similar to that of Java and Perl, unlike that PHP can be embedded in HTML code. PHP is also for the large family of descendants of C, whose syntax is very close.

In use Web, PHP code execution takes place as well: when a visitor asks to see a web page, the browser sends a request to the HTTP server correspondent. If the page is identified as a PHP script (usually through the extension. Php), the server calls the PHP interpreter to process and generate the final code of the page (usually consisting of HTML or XHTML, but also often Css and JS). This content is returned to the HTTP server, which sends finally to the customer.

This pattern explains this operation:
A further step is often added: that of dialogue between PHP and the database. Traditionally, PHP opens a connection to the server DBMS manner, it sends queries and get the result, before closing the connection.
Screenshot of vi background, displaying a PHP script, and right the result of the script interpreted by PHP
Screenshot of vi background, displaying a PHP script, and right the result of the script interpreted by PHP

Using PHP as a generator of dynamic web pages is the most widespread, but it can also be used as the programming language command line without using HTTP server or browser.

To achieve a PHP script executable from the command line, just as in Perl or bash to insert the code in the first line shebang: #! / Usr / bin / php (/ usr / bin / directory is the standard executable binary files on most distributions).

There is also an extension called PHP-GTK to create client applications on a computer graphics with the GTK graphics library.

PHP has many functions to operations on the file system, management of databases, sorting functions and hash, treatment of strings, generation and editing images, compression algorithms ...

The engine of Wikipedia is written in PHP with a MySQL database. It therefore fits in a LAMP platform.

Presentation of PHP

PHP is used mainly as a scripting language on the server side, which means that the server (the machine that hosts the Web page in question) which will interpret the code and PHP code generation (consisting generally of 'XHTML or HTML, CSS, JavaScript and sometimes), which may be interpreted by a browser. PHP can also generate other formats in connection with the Web, as WML, SVG, PDF, or bitmap images such as JPEG, GIF or PNG.

It was designed to allow the creation of dynamic applications, mostly dedicated to the Web. PHP is overwhelmingly installed on an Apache server, but can be installed on other key HTTP server market, for example IIS. This coupling will retrieve information from a database, a file system (files and content of the tree) or simply data sent by the browser to be read or stored for use Later.

It is a little typed language and flexible and thus easy to learn for a beginner but, as a result, security holes may appear in applications. Pragmatic PHP stopped doing no theory and tends to choose the most direct route. However, the name of the functions (and the passage of arguments) does not always a logical uniform, which may be detrimental to learning.

Its use begins with the processing of forms and through access to databases. Access to databases is easy once the installation of modules performed on the server. The most obvious strength of this language is that it has become over time a must offers of accommodation.

Free, free, easy to use and installation, this language requires like any language network a good understanding of underlying mechanisms and knowledge of security issues.

Version 5.3 will use the namespaces, a key factor in the development of extensions, libraries and structured frameworks.

Version 6 will introduce in-house library ICU language giving the option to treat Unicode natively.

PHP History

PHP is created in 1994 by Rasmus Lerdorf to its Web site. It was originally a software library in Perl which he used to keep track of visitors who came to visit his CV. As it added new features, Rasmus has transformed the library into an implementation in C, able to communicate with databases and create dynamic and simple applications for the Web. Rasmus then decided in 1995 to publish its code, so that everyone can use and enjoy. PHP then PHP / FI (for Personal Home Page Tools / Form Interpreter). In 1997, two students, Andi Gutmans and Zeev Suraski, redéveloppèrent the heart of PHP / FI. This work led one year later with Zend Engine, the new heart of PHP / FI, then became PHP: Hypertext Preprocessor version 3. [5]

In 2002, PHP is used by more than 8 million websites around the world [6], and in 2004 by more than 15 million [ref. desired].

A paradoxical indicator of the popularity of PHP is the number of security vulnerabilities related applications with PHP and listed on an identifier CVE database American vulnerabilities (National Vulnerability Database). These faults represent 12% of the total in 2003, 20% in 2004, 28% in 2005, 43% in 2006, 36% in 2007, 38% on the first two months of 2008. More than a quarter of vulnerabilities identified on this basis relates to PHP applications, more than a third in recent years, and most can be operated remotely [7]. These vulnerabilities are due to bad habits programming (often a lack of validation of entries) along with questionable features of language itself (for example, register globals, now discouraged [8]).

The current version is version 5, released on July 13 in 2004 [9]. It uses Zend Engine 2 and introduces a true object model, management errors based on the model of exceptions, as well as management features for businesses. PHP 5 offers many new features, such as support for SQLite, which is a lightweight database management board, to the detriment of the MySQL client library, more powerful but is now enabled by default, and as ways to manipulate files and structures based on XML libxml2:

* A simple API called SimpleXML,
* API Document Object Model fairly complete,
* XPath interface using the DOM objects and SimpleXML,
* Integration of libxslt for XSLT transformation via XSL extension,
* A much better management of objects in relation to PHP 4, with opportunities equivalent to those of Java.

The last update is 5.2.6 on 1 May 2008 [10].

Version 4.4.x is no longer maintained since 31 December 2007 [9], [11]. Only critical security patches will be further developed until 8 August 2008 [11].

The next version of PHP: PHP 6 is still under development and will be available in late 2008.