Dont Stop til You get enough php script 10 tips 1

Source: Internet
Author: User
Tags phpinfo
Installing PHP as Apache DSO
PHP is often used with Apache Web servers for the Linux/unix platform. When we install PHP in the Apache environment, you have three installation modes to choose from: Static modules, dynamic modules (DSO), and CGI.
I suggest you better install PHP as apached DSO, this installation mode maintenance and upgrade are quite simple. Suppose, for example, that you have only installed PHP's database support functionality. But after a few days, you decided to add encryption to PHP. It's simple, you just type the make clean command, then add new configuration options, and then execute the make and make install commands. This way, the new PHP module will be installed in the appropriate location on Apache, you just restart Apache all OK, of course, the whole process does not have to recompile Apache.
The simple steps to install a new version of Apache and install PHP as Apache DSO are as follows:
1. Download the latest version of the Apache Server Software source code from the Apache Software Foundation site.
2. Place the code file in a suitable directory such as/usr/local/or/opt/.
3. Unzip the code file with the Gunzip command, then you can get the corresponding *.tar file.
4. Type the following unpacking command to place the above tar file in a directory of Shape Apache_[version]:
TAR-XVF Apache_[version].tar
5. Go to the/usr/local/apache_[version] directory (or the directory you specified in the steps above).
6. Type the following configuration command, using the path you set (such as/usr/local/apache[version], and so on, note that the trailing slash! ) instead of the [path] parameter, you also enable the MOD_SO parameter to allow Apache to use DSO.
./configure--prefix=[path]--enable-module=so
7. Go back to the command prompt and type the make command and wait for the command to complete again to return to the command prompt.
8. Type make install.
By this time, the compiler can create the final directory and return to the system's command prompt state.
Next, install PHP:
1. Visit the download area of the PHP home page to select the latest version of the source code link.
2. Place the downloaded file in an appropriate directory such as/usr/local/or/opt/.
3. Unzip the code file with the Gunzip command, then you can get the corresponding *.tar file.
4. Type the following unpacking command to place the above tar file in a directory of Shape Php-[version]:
TAR-XVF Php-[version]
5. Go to the/usr/local/php-[version] directory (or the directory you specified).
Now you can compile the PHP DSO, in fact, there is only a necessary configuration option--with-apxs (a file in the Apache Bin directory)--however, in order to more comprehensive system configuration, we also added to the MySQL database support.
./configure--with-mysql=/[path to MySQL]--with-apxs=/[path to APXS]
6. Go back to the command prompt and type the make command and wait until the command completes again to return to the command prompt.
7. Type the make install command.
At this time, the compiler will create the final DSO, and put it in the Apache module directory, but also for you to modify the Apache httpd.conf configuration file, then the system back to the command prompt state to wait for you to enter new instructions. You can then open Apache's httpd.conf configuration file to make some corrections:
1. Find a line with the serveradmin Word and add your own email address as follows:
ServerAdmin you@yourdomain.com
2. Locate the line that starts with servername, and modify the following parameters to the actual values, such as:
ServerName localhost
3. Find the following paragraph:
# and for PHP 4.x, use:
#
#AddType application/x-httpd-php. php
#AddType Application/x-httpd-php-source. Phps
Modify these configuration lines to cancel some comments that precede PHP 4.0 with AddType, and you should add some of the file extensions that are used for PHP, and the modified lines may look like this:
# and for PHP 4.x, use:
#
AddType application/x-httpd-php. php. phtml
AddType Application/x-httpd-php-source. Phps
To save the above configuration file, go back to the parent directory and type the following command to launch Apache:
./bin/apachectl Start
If there are no problems during startup, you can test the installation of Apache and PHP by creating a file called phpinfo.php, which contains the following lines of code:

Save the file and place it in the Apache document root (htdocs), then launch your Web browser, type http://localhost/phpinfo.php in the browser address bar, and the browser will display the various variables and variable values for PHP and Apache system in a large space.
If you want to reset PHP, all you have to do is execute the make clean command, then execute the./configure command with the new configuration option, then execute make and make install. In this way, a new module appears in the Apache module directory, and you simply reboot Apache to load the new module. Many of the headache problems of the past are now solved.

The above describes the dont stop til you get enough php script 10 tips 1, including the dont stop til you Get enough aspects of the content, want to be interested in PHP tutorial friends helpful.

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.