win7 64-bit Apache http server+PHP configuration

WBOY
Release: 2016-07-25 09:12:06
Original
1087 people have browsed it

1. First download the apache http server (I originally wanted to download it from the official website, but I couldn’t find it after searching for a long time, so I downloaded an old version online). I downloaded it from this website: http://download.csdn .net/download/chang87812/7175961

Download PHP: Similarly, I downloaded the latest version from the official website (URL: (http://windows.php.net/downloads/releases/)

But then there was a problem after configuring it.

The problem is: httpd: Syntax error on line 129 of D:/PHP/server/httpd-2.2-x64/conf/httpd.conf: Cannot load D:/ApaServ/php/php5apache2_4.dll into server: xd5xd2xb2xbbxb5xbdxd6xb8xb6xa8xb5xc4xc4xa3xbfxe9xa1xa3.

The reason is: this file must correspond to the version, otherwise it cannot be loaded. Later, the same prompt appeared again, but it was changed to php5.4.8. At line 174, the activation context generation of "D:ApaServphpphp5apache2_4.dll" failed. Dependent assembly vcredist_x86.exe cannot be found. Later, the solution was: Reinstall vcredist_x86.exe. This was installed before I installed apache. The files inside may have been rewritten, so they cannot be found. I also looked online: I found the following files under something like C:Program FilesMicrosoft Visual Studio 8VCredi stDebug_NonRedistx86Microsoft.VC80.DebugCRT:
msvcm80d.dll msvcp80d.dll msvcr80d.dll Microsoft.VC80.DebugCRT.manifest Copy these files to On the target machine, put it in the same folder as the running program or put it under system32, and it will run correctly.
For other release versions, MFC programs, etc., just copy the files in the corresponding folders under redist. There are signs after the folders!

I just thought of this after receiving this tip. Later, when installing php5.5, this error message appeared again. I installed the VC++2010 runtime library according to my own understanding at first, but no matter how I debugged, I still got this error. Later, I downloaded the highest version of VC from the Internet. ++2012 runtime library, it was successful immediately. (I found this reason on the Internet, but I haven’t put it into practice. I don’t want to install the VC++2012 runtime library anymore!!!)

So I found an old version of PHP on the Internet, download URL: http://download.csdn.net/download/tonyyxm/5428271

2. Install Apache

1. Unlike 32-bit Apache, it can be packaged into an exe file and can be installed directly. First, unzip httpd-2.2.19-win64 to E:/server/ apache- httpd-2.2.19-win64/ (/*E is The drive letter where the specific server file is located */)

2. Run the command prompt as an administrator (Start-Programs-Accessories) and enter E:/server/apache-httpd-2.2.19-win64/

3. Execute httpd -k install

A problem occurred here: failed to open the winNT service manager

Solution: It turns out that the software conflicts with the "User Account Control" (UAC) of Windows 7 during the software installation. Just turn off UAC first (Control Panel-User Accounts and Family Safety-System and Security-Action Center, there is "Change User Account Control" "Settings", change it to "Never notify". After completion, you will be prompted to restart. At this time, you need to restart) and then install it. There will be no problem. You can modify it back after the installation is completed.

4. Modify httpd.conf. The configuration here is the same as in the 32-bit system

(1) Modify ServerRoot "E:/server/httpd-2.2.19-win64/"

(2) Go down and you will see the function modules enabled by apache, such as: #LoadModule vhost_alias_module modules/mod_vhost_alias.so

Module added later:

LoadModule php5_module "E:/Server/php-5.3.6-Win32-VC9-x64/php5apache2_2.dll"

PHPiniDir "E:/Server/php-5.3.6-Win32-VC9-x64/"

AddType application/x-httpd-php .html .htm .php

(3) Continue down and find the line DocumentRoot "E:/Code/PHP/" to set the web page file directory. This line should be modified to correspond to the directory setting after the line # This should be changed to whatever you set DocumentRoot to

5. Execute httpd -k start in the command prompt again. If there is no error, the apache service starts successfully

6. Shut down the Apache server: execute httpd -k shutdown

3. Configure PHP

1. As mentioned above, decompress my php directory to E:/Server/php-5.3.6-Win32-VC9-x64/, which corresponds to the LoadModule location set in Apache in the previous step

2. Modify php.ini-development to php.ini

3. Open php.ini, find extension_dir, and modify its value to E:/Server/php-5.3.6-Win32-VC9-x64/ext/, which is the directory where the php file is located/ext

4. Find the extension list, remove the ";" in front of ;extension=php_gd2.dll, ;extension=php_mysql.dll, ;extension=php_mysqli.dll to enable the extension. Of course, the above extensions are for example only and can be adjusted according to the function. Although different requirements are required, please enable the corresponding extension

5. (Optional) Set the value of date.timezone to Asia/Shanghai, that is, date.timezone =Asia/Shanghai

6. Create a test.php file under E:/Code/PHP/ with the content

 phpinfo();

?>

Then enter http://localhost/test.php in the browser address bar

The above configuration process belongs to someone else: after I configured it, the following two problems occurred:

1. httpd: Could not reliably determine the server's fully qualified

Solution: Foreword: Although apache can run, I saw the error httpd.exe: Could not reliably determine the server's fully qualified domain name, using 192.168. x. Others occupy port 80
Start--Run--cmd Enter the command prompt and enter netstat -ano to see the PID of all connections. Then find the program corresponding to this PID in the task manager. If there is no PID in the task manager, For one item, you can select "View" - "Select Column" in the task manager
Often, when we start an application, we find that the port required by the system is occupied by other programs. How do we know who occupies the port we need? Many people wonder It is quite a headache. Here is a very simple method, I hope it will be useful to everyone. If we need to determine who is occupying our 80 port, 1. Windows platform, execute in the windows command line window:
C:>netstat -aon |findstr "80"
TCP 127.0.0.1:80 0.0.0.0:0 LISTENING 2448
See, the port is occupied by the process with process number 2448, continue to execute the following command:
C:>tasklist|findstr "2448"
thread.exe 2016 Console 0 16,064 K
It’s very clear, thread occupies your port, Kill it
If you can’t find it in the second step, then open the task manager, see which process is 2448, and then kill it.
Check other ports if needed. Just change 80
Addition: It turns out that the reason for this error (httpd.exe: Could not reliably determine the server's fully qualified domain name, using 192.168.1.111 for ServerName) is because the DNS is not configured properly. If you don't want to configure DNS, just In httpd.conf, add ServerName localhost:80 at the front

2. "(OS 10013) An attempt was made to access the socket in a manner not permitted by access permissions. : make_sock: could not bind to address 0.0.0.0:80"

Solution:

Change the port, open .apacheconfhttpd.conf, change all 80 in it to 81, save and restart apache, OK.

After changing the port, visit the following URL: http://localhost:81/test.php

Screenshot:

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template