A practical article on how to install Apache and PHP

Source: Internet
Author: User
AnywhereliuxiLzl@163.netPHP installation steps, there are a lot of information online, are very detailed. However, since the installation of free software such as Apache and PHP does not have a friendly user interface as the commercial software does, many netizens rarely encounter such a kind of stuff, even though there is a copy of installation information next to it, but there are still many problems. I have many labels on Linux and php in China: Apache Anywhere liuxiLzl@163.net
PHP installation steps, there are a lot of information online, are very detailed. However, since the installation of free software such as Apache and PHP does not have a friendly user interface as the commercial software does, many netizens rarely encounter such a kind of stuff, even though there is a copy of installation information next to it, but there are still many problems. On many forums in China regarding Linux and php, I also noticed similar questions from many netizens. Therefore, I have written out the solutions to these problems that I know. if they are not correct, please point them out.
1. installation of free software, whether in Win32 or Linux, usually has README. read it carefully before installation, there will be a lot of gains.
II. install Apache
This step should be relatively simple. as long as you remember to set BindAddress, ServerName, and DocumentRoot in httpd. conf, you should be able to see the familiar Apache icon. BindAddress refers to the IP address that can be answered. it can be *, an IP address, or a complete domain name. ServerName is the host name. if there is no domain name, you can use an IP address. DocumentRoot is the default home page. After modifying httpd. conf, remember to restart Apache.
3. install PHP
There are many problems in this step. in the final analysis, there are two reasons: one is that PHP does not work, because httpd. the configuration of PHP in conf is incorrect. Another problem is that PHP is started, but there is an error when running the php file. this is because PHP. ini is not set.
1. httpd. conf settings
In win32, these rows cannot be fewer.
ScriptAlias/php "d:/php/php.exe"
Action application/x-httpd-php "/php"
AddType application/x-httpd-php. php. php3
The first two lines indicate the location of the PHP script interpreter and the third line indicate the file suffix to be interpreted by the PHP script.
If it is not PHP4 but PHP3, change "application/x-httpd-php" to "... httpd-php3", remember.
If the preceding two rows are not set, the PHP file will be downloaded or displayed on the page.
In Linux, if PHP runs as an Apache module, you only need to add the third line. However, you should pay attention to the steps when installing PHP first, after configure Apache, add -- activate-module = {libphp4.a path}, and then make, make install ......

If you want to support pre-defined items such as index. php, you also need to find this sentence: Directory Index index.html, followed by index. php index. php3 ......

After completing these steps, write a php program, , There should be a result, huh, huh.

2. php. ini settings
After installing php, many users always see
"X-Powered-By: PHP/4.0.0 Expires: Thu, 19 Nov 1981 08:52:00 GMT Cache-Control: no-cache, post-check = 0, pre-check = 0 Pragma: no-cache Content-type: text/html"
This kind of things happened when I installed PHP4 for the first time. at that time, due to the fact that PHP4 was just launched, there was very little information on the Internet, and I had forgotten it myself. As long as you
Windows Extensions
This section can be solved by commenting out with semicolons, because PHP4 already contains support for MySQL, GD, etc. Unlike PHP3, these dll must be included in win32.

In addition to this problem, there are also problems such as session and file upload. for such problems, you can refer to the execution result of phpinfo () to find the cause. generally, no path is set, as long as it is in php. find the corresponding settings section in ini to see if there is anything not set up. just fill it in and there are detailed English comments next to it.

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.