8 tips for PHP scripts (1)

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 Apache DSO PHP and Apache Web 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. the protection and upgrade of this installation mode are quite simple. Let us assume that you have installed only the database support function of PHP. After a few days, you decided to add encryption for PHP. You just need to press 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 for the whole process. The simple steps for installing a new version of Apache and PHP that pretend to be 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. press the unpack command below to put the above 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. enter 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 promise the Apache application DSO. ./Configure -- prefix = [path] -- enable-module = so 7. return to the command prompt, prompting you to enter the make command and return to the command prompt state after the command is executed.
8. press make install. At this time, the compiler can create the ultimate directory and return it to the command prompt state of the system. Next install PHP: 1. visit the download area of the PHP homepage to select the link of the latest source code.
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. press 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. here, 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. go back to the command prompt line and press "make" to enter the command and return to the command prompt state again after the command is executed.
7. press the make install command. At this time, the compiler will create the ultimate DSO, put it under the Apache module directory, and fix Apache httpd for you. in the conf configuration file, the system returns to the command prompt status and waits for you to enter the new command. Then, you can open Apache's httpd. make some modifications to the conf configuration file: 1. find a line with ServerAdmin words and join your own email address, as shown below: ServerAdmin you@yourdomain.com 2. locate a row starting with ServerName and correct 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 fixes these configuration lines to cancel some comments added before AddType under PHP 4.0, and you should add some extended names for the files applied by 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 retains the preceding configuration file and returns to the parent directory. press the following command to start Apache :. /bin/apachectl start if no title is displayed during startup, you can test the installation of Apache and PHP by creating a phpinfo. the php file contains the following code lines: Keep the file and place it in the Apache document root directory (htdocs). Then, start your Web browser and press 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 only 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, the Directory of the Apache module will display a new module. 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.