Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install and use mainstream Apache 2 PHP5

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

How to carry out the mainstream Apache 2 PHP5 installation and use, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain in detail for you, people with this need can come to learn, I hope you can get something.

We all know that Apache 2 and PHP are popular solutions for creating interactive websites at a low cost. We are here to give you a detailed introduction to Apache 2 PHP5 installation tips. In the Windows installation section of the PHP 4.3 manual, there is no explanation on how to use Apache 2 PHP5, while the section on Apache 2 PHP5 installation is missing a lot of information you need. Other installation guides published online also contain a lot of errors, so that some installers have to keep trying and making mistakes. For example, some people even replace PHP's DLL with other PHP versions of DLL. OK, in order to save your valuable time, we have prepared this most authoritative guide article to help you get rid of all your troubles.

Use the correct version of Windows

First of all, let's talk about compatibility: Apache 2 cannot run on Windows 95; it can barely run on Windows 98, but it cannot be used as a service. Starting with version 4.3, PHP no longer supports Windows 95. Therefore, your Windows operating system must be Windows NT, 2000 or XP.

Apache 2: source or binary?

If you have Visual C++ 5.0 or higher, or if you have Microsoft Visual Studio installed, you can generate Apache from the source code, but never do so. In Visual Studio IDE, the generation process under Windows is very complex. Even compiling from the command line is definitely not an easy task. So, unless you like to create makefile, * get a Windows Installer binary distribution, which is a .msi file. When you know enough about Apache and know what custom operations you need to do, you can consider generating (compiling) Apache yourself.

If you have installed and are running the old version of Apache, stop it first, uninstall it, and then start installing the new server. Multiple versions of Apache 2 cannot coexist.

Double-click the Apache 2.msi file. After agreeing to the license agreement, set Network Domain and Server Name correctly (if you do not plan to install Apache on a remote computer, then set localhost), enter your email address in the Administrator's Email Address area, and keep the port 80 / service option radio button selected. If you choose Typical installation in the next dialog box, you can quickly get a server environment that actually works.

Apache 2 PHP5 installation Tip

It is recommended that you change the default installation directory from C:\ Program Files\ Apache Group to C:\ Apache or another name that conforms to the 8.3 file name format. This way, every time you enter the Apache installation path later, you don't have to quote it.

In a moment, the installation wizard will tell you that Apache 2 has been installed successfully. The only thing to do next is to test. Open your browser and visit localhost, so you should see the default Apache 2 home page.

You can then delete all the sample files in the main Web server directory, which are located by default in C:\ InstallDirectory\ Apache\ Apache2\ htdocs. If you have a ready-made home page Index.html, please copy it here; alternatively, you can create a blank home page right away. For an uninitialized HTML, the following code is fine:

Title=default server pagehead > Default server pagebody > html >

Get Apache 2 ready for PHP

From now on, you need to install more manually, rather than simply clicking and selecting a few options. Get used to it as soon as possible, this is the way of Apache. You need to edit the file to set different configuration options; if you do not do it properly, your changes will prevent Apache from loading correctly. If the setting raises an error, the error may be logged in the Apache2 error log (default is C:\ InstallDir\ Apache2\ Logs\ Error.log). But there are only a few people who can log like this, and most of the errors will only be recorded in the Windows event log (start | Settings | Control Panel | Administrative tools | event Viewer).

Unfortunately, the Windows event log is not a convenient tool when you debug your installation settings. It is better to test the load of the Apache server in the command line window so that you can see the error report immediately. So, after completing the configuration changes I'm about to discuss, open a command-line window, change to Apache's binary directory (C:\ InstallDir\ Apache2\ bin), and start Apache there. The Apache configuration file is C:\ Apache\ Apache2\ Conf\ Httpd.conf and can be edited with any text editor. Look for DirectoryIndex and navigate to the following line:

DirectoryIndex index.html index.html.var # index.php

To allow Apache to process PHP pages, remove the comment character (#) and change it to:

DirectoryIndex index.html index.html.var index.php

Also allow the use of .htaccess files in any directory, so look for AllowOverride in the configuration file and change this setting from None to All. After you have saved your changes, you can continue to open the file in a text editor because you will edit the file again when you install PHP later.

Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report