Home >Backend Development >PHP Tutorial >How to use the dynamic shared object pattern to_PHP tutorial
PHP is usually installed on Linux/Unix operating systems and used with the Apache server. When installing PHP with the Apache server, you have three different installation methods to choose from: static modules, dynamic shared objects (Dynamic Shared Object, DSO) and CG
I program executable files.
Here I recommend that you use the dynamic shared object mode to install PHP, because this installation method provides great convenience for future maintenance and upgrades. Suppose that when you first installed PHP, you only added PHP's database-related modules. A few days later, you decide to install PHP coding function-related modules. At this time, you only need to enter the make clean command in your system command line, then enter the new PHP setting options, and then enter the make and make install commands, and then After that, the system will generate a new PHP dynamic shared object and install it to the appropriate directory location specified by the Apache server. All you need to do next is to reactivate the Apache server. You don't need to recompile the entire Apache server.
The following basic steps can allow you to install a new Apache server, including PHP dynamic loading module:
1. Go to http://www.apache.org/dist/ to download the latest version of the Apache server source code.
2. Copy the obtained file to a meaningful directory location, such as /usr/local/ or /opt/, or other directory location you feel is appropriate.
3. Unzip the obtained file. After unzipping, you will get some *.tar files.
4. Enter the following command to unpack these *.tar files, and place the unpacked files into a directory location named apache_[version]:
tar -xvf apache_[version] .tar
5. Enter the cd command to switch the working directory to /usr/local/apache_[version] (if you extracted the *.tar file to a different directory in the previous step, then switch to the one you specified directory)
6. Enter the following command to prepare the compiler. Remember to replace the [path] part in the following command with your own directory name, such as /usr/local/apache[version] (do not add the last The slash on the surface! ). What this step does is activate mod_so so that the Apache server can use dynamic shared objects.
./configure --prefix=[path] --enable-module=so
7. Wait until the system returns to the command prompt, enter make, and then continue to wait for the system to return to the command prompt.
8. Enter the make install command.
At this time, the compilation program will generate the directories and files needed for the final use. After completion, you will return to the command prompt again.
Now you can start installing PHP:
1. Go to the PHP official website: http://www.php.net/downloads.php to download the latest version of the PHP original program code.