The world's more than 3 million Internet Web site governance members are using PHP, making it one of the most popular server-side scripting languages. It is characterized by fast operation, stable and reliable, cross-platform, and open source software. Depending on the level you use, PHP can be simple or complex, and you can use it to send HTML form elements and integrate Java and XML into your PHP application.
If you have a certain understanding of PHP or read some preliminary textbooks, these techniques can expand your familiarity with PHP, so that you grasp some common and advanced PHP features.
First, the PHP installed as Apache DSO
PHP on the Linux/unix platform often with the use of Apache, in the installation of PHP, there are three ways to install the choice: static mode, dynamic mode (DSO), CGI binary mode.
Because it is easy to maintain and upgrade, I strongly recommend the DSO to install PHP. For example, if the installed PHP only supports the database at the initial installation, and then you want to install the module that supports encryption, just run "make clean", add a new configuration option, and then run "make" and "Make Install", A new PHP module will be installed in the appropriate location in Apache and then restart Apache without recompiling Apache.
The following steps will install a new Apache and install PHP as a DSO:
1, from the Apache Software Foundation to get the latest version of the Apache source code;
2, put the source code into the/usr/local/or/opt/directory, or you specify any directory;
3, the Operation Gunzip to the file for decompression, get suffix of. tar files;
4. Run the following command to install the file in the Apache_[version] directory:
TAR-XVF Apache_[version].tar
5, into the/usr/local/apache_[version] directory (or in step 4 to install the directory of compressed files);
6, type the following command for compiling Apache preparation, with your own path to replace the [path], for example,/usr/local/apache[version], now has set the new value of MOD_SO, it will allow Apache to use the DSO module;
7. When you return to the prompt state, type make and wait to return to the prompt again;
8, execute "make install" command.
At this point, Apache has been installed and the system will return to the prompt state. Next we start installing PHP:
1, the PHP homepage in the download area to find the latest version of the link;
2. Download the file to an appropriate directory, such as/usr/local/or/opt/or any directory you specify;
3, the Operation Gunzip to the file for decompression, get suffix of. tar files;
4, execute the following command to install the file in the Php-[version] directory:
TAR-XVF Php-[version]
5. Enter the/usr/local/php-[version] directory or the directory specified in step 4;
At this point, has been done to the DSO way to install PHP preparation work, the only need to modify the configuration option is With-apxs (this is the Apache Bin directory of a file). To achieve higher performance, I did not install a support module for MySQL.
./configure--with-mysql=/[path to MySQL]--with-apxs=/[path to APXS]
6, go back to the prompt state to execute make command, waiting to return to the prompt state;
7, execute make install command.
At this point, the system to DSO way in the Apache module directory installed PHP, and the Apache httpd.conf file to make appropriate changes to return to the prompt state. When you return to the prompt, you will also need to make some changes to the Apache httpd.conf file.
1, find a line containing serveradmin, add your e-mail address, as follows:
ServerAdmin you@yourdomain.com
2, find the line beginning with servername, and change it to a real value, for example:
ServerName localhost
3, find the content below the section:
# and for PHP 4.x, use:
#
#AddType application/x-httpd-php. php
#AddType Application/x-httpd-php-source. Phps
Modify the contents of these lines so that PHP 4.0 's AddType is no longer a comment and add the file suffix name that you want to use in PHP, which changes to the contents shown below