8 tips for PHP scripts (1) install PHP as Apache DSO

Source: Internet
Author: User
Tags install php mysql database
PHP often works with Apache Web servers on Linux/Unix platforms. When installing PHP in Apache, you have three installation modes available: static module, dynamic module (DSO), and CGI.

I suggest you install PHP as Apached DSO, which is easy to maintain and upgrade. For example, assume that you have installed only the database support function of PHP. After a few days, you decided to add the encryption function for PHP. You just need to enter the make clean command, add new configuration options, and then execute the make and make install commands. In this way, the new PHP module will be installed to the proper position on Apache. You only need to restart Apache and everything will be OK. Of course, you do not need to re-compile Apache throughout the process.

The simple steps for installing a new version of Apache and installing PHP as Apache DSO are as follows:
1. Download the latest Apache server software source code from the Apache Software Foundation site.

2. Put the code file in a suitable directory such as/usr/local/or/opt.

3. Decompress the code file using the Gunzip command, and then you can get the corresponding *. tar file.

4. Type the following decommission command to put the preceding tar file in the directory named apache _ [version:
Tar-xvf apache_{version}.tar
5. Enter the/usr/local/apache _ [version] Directory (or the directory you specified in the above step ).

6. Type the following configuration command and use the path you set (for example,/usr/local/apache [version]). Be careful not to follow the Slash !) Replace the [path] parameter, and enable the mod_so parameter to allow Apache to use DSO.

./Configure -- prefix = [path] -- enable-module = so
7. Return to the command prompt line, type the make command, and return to the command prompt state again after the command execution is complete.

8. Type make install.

At this time, the compiler can create the final directory and return it to the command prompt state of the system.

Next, install PHP:
1. Visit the PHP homepage to download the source code of the latest version.

2. Put the downloaded file in a directory such as/usr/local/or/opt.

3. Decompress the code file using the Gunzip command, and then you can get the corresponding *. tar file.

4. Type the following unpack command to put the above tar file in the directory named 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, you only need a necessary configuration option -- with-apxs (a file in the Apache bin directory) -- however, to make the system configuration more comprehensive, we have also added support for the MySQL database.

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.