PHP Tutorial: Linux under the installation and configuration of PHP server

Source: Internet
Author: User

1, #cp httpd-2.0.47.tar.gz to/usr/local/
2. #tar ZXVF php-4.3.3.tar.gz
3. #cd php-4.3.3
4, #./configure--with-mysql--WITH-APXS2=/USR/LOCAL/APACHE/BIN/APXS
#./configure-with-apache=/path/to/apache/dir-with-mysql=/usr/local/mysql
5, #make
6, #make install (while waiting for the side to bless it)
7. #cp Php.ini-dist/usr/local/lib/php.ini
8. #vi/usr/local/apache2/conf/httpd.conf
9. Under AddType application/x-tar.tgz, add the following:
AddType application/x-httpd-php. php
LoadModule php4_module/var/www/modules/libphp4.so (if not added)
10. #vi/usr/local/apache2/htdocs/test.php
?
Echo Phpinfo ();
?>
11, browse http://ip/test.php. The PHP information appears. Congratulations on the success of this step.

Basic configuration of PHP and Apache after installation
1.Apache of configuration
The Apache configuration file is/usr/local/apache2/conf/httpd.conf, edit the httpd.conf file, and add the following two lines to the end of the file:
LoadModule Php4_module modules/libphp4.so
AddType application/x-httpd-php. php. php3
At the same time modify DirectoryIndex to:

DirectoryIndex index.htm
DirectoryIndex index.html
DirectoryIndex index.php
DirectoryIndex index.php3
DirectoryIndex INDEX.PHP4

Apache configuration is rich in content, other Apache related configuration Please refer to the Apache related documentation.
2.PHP of configuration
The Apache configuration file is/usr/local/lib/php.ini, editing the php.ini file to configure PHP options. It is particularly noted that the Register_globals variable is set to off by default after installation, and needs to be changed to ON. Otherwise, there will be a phenomenon that PHP cannot read the post data.
Zlib.output_compression=on
Register_globals=on
Other PHP options please refer to the relevant documentation.
3. Test
Can write a simple php file to test the installation, the file contains the following line:
Save it as/usr/local/apache2/htdocs/info.php, start Apache, and then browse through the browser.



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.