10 tips for PHP script conversion from ZDNet -- install PHP as ApacheDSO

Source: Internet
Author: User
Installing PHP as ApacheDSOPHP often works with the ApacheWeb Server for 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.

Installing PHP as Apache dso php often works with the Apache Web server on the Linux/Unix platform. 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 version of Apache server software 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 unpack command to put the preceding tar file in the directory named apache _ [version]: tar-xvf apache_1_version=.tar 5. go to 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 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 download area on the PHP homepage and select the link to 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.. /Configure -- with-mysql =/[path to mysql] -- with-apxs =/[path to apxs] 6. return to the command prompt line, type the make command, and return to the command prompt state after the command execution is complete. 7. type the make install command. At this time, the compiler will create the final DSO, put it under the Directory of the Apache module, and modify the httpd of Apache for you. in the conf configuration file, the system returns to the command prompt status and waits for you to enter a new command. Then, you can open Apache's httpd. make some modifications to the conf configuration file: 1. find a line with ServerAdmin, add your own email address, as shown below: ServerAdmin you@yourdomain.com 2. find a row starting with ServerName and change the following parameter to the actual value, for example, ServerName localhost 3. find the following section: # And for PHP 4.x, use: # AddType application/x-httpd-php. php # AddType application/x-httpd-php-source. phps modifies these configuration lines to cancel some comments added before AddType in PHP 4.0, and you should add some file extensions for PHP, the modified rows may look like the following: # And for PHP 4.x, use: # AddType application/x-httpd-php. php. phtml AddType application/x-httpd-php-source. phps saves the preceding configuration file and returns to the parent directory. type the following command to start Apache :. /bin/apachectl start if no problem occurs during startup, you can test the installation of Apache and PHP by creating a phpinfo. the php file contains the following code lines: Save the file and place it in the Apache document root directory (htdocs). Then, start your Web browser and type http: // localhost/phpinfo in the address bar of the browser. php, the browser will display the various variables and variable values of the PHP and Apache systems in a large space. If you want to reset PHP, you need to execute the make clean command, then execute the./configure command with the new configuration options, and then execute make and make install. In this way, a new module will appear in the Apache module directory. you only need to restart Apache to load the new module. Many headaches have been solved now.

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.