Home Backend Development PHP Tutorial win7 64-bit Apache http server+PHP configuration

win7 64-bit Apache http server+PHP configuration

Jul 25, 2016 am 09:12 AM

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:

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How does session hijacking work and how can you mitigate it in PHP? How does session hijacking work and how can you mitigate it in PHP? Apr 06, 2025 am 12:02 AM

Session hijacking can be achieved through the following steps: 1. Obtain the session ID, 2. Use the session ID, 3. Keep the session active. The methods to prevent session hijacking in PHP include: 1. Use the session_regenerate_id() function to regenerate the session ID, 2. Store session data through the database, 3. Ensure that all session data is transmitted through HTTPS.

Explain JSON Web Tokens (JWT) and their use case in PHP APIs. Explain JSON Web Tokens (JWT) and their use case in PHP APIs. Apr 05, 2025 am 12:04 AM

JWT is an open standard based on JSON, used to securely transmit information between parties, mainly for identity authentication and information exchange. 1. JWT consists of three parts: Header, Payload and Signature. 2. The working principle of JWT includes three steps: generating JWT, verifying JWT and parsing Payload. 3. When using JWT for authentication in PHP, JWT can be generated and verified, and user role and permission information can be included in advanced usage. 4. Common errors include signature verification failure, token expiration, and payload oversized. Debugging skills include using debugging tools and logging. 5. Performance optimization and best practices include using appropriate signature algorithms, setting validity periods reasonably,

Describe the SOLID principles and how they apply to PHP development. Describe the SOLID principles and how they apply to PHP development. Apr 03, 2025 am 12:04 AM

The application of SOLID principle in PHP development includes: 1. Single responsibility principle (SRP): Each class is responsible for only one function. 2. Open and close principle (OCP): Changes are achieved through extension rather than modification. 3. Lisch's Substitution Principle (LSP): Subclasses can replace base classes without affecting program accuracy. 4. Interface isolation principle (ISP): Use fine-grained interfaces to avoid dependencies and unused methods. 5. Dependency inversion principle (DIP): High and low-level modules rely on abstraction and are implemented through dependency injection.

How to debug CLI mode in PHPStorm? How to debug CLI mode in PHPStorm? Apr 01, 2025 pm 02:57 PM

How to debug CLI mode in PHPStorm? When developing with PHPStorm, sometimes we need to debug PHP in command line interface (CLI) mode...

How to automatically set permissions of unixsocket after system restart? How to automatically set permissions of unixsocket after system restart? Mar 31, 2025 pm 11:54 PM

How to automatically set the permissions of unixsocket after the system restarts. Every time the system restarts, we need to execute the following command to modify the permissions of unixsocket: sudo...

Explain late static binding in PHP (static::). Explain late static binding in PHP (static::). Apr 03, 2025 am 12:04 AM

Static binding (static::) implements late static binding (LSB) in PHP, allowing calling classes to be referenced in static contexts rather than defining classes. 1) The parsing process is performed at runtime, 2) Look up the call class in the inheritance relationship, 3) It may bring performance overhead.

How to send a POST request containing JSON data using PHP's cURL library? How to send a POST request containing JSON data using PHP's cURL library? Apr 01, 2025 pm 03:12 PM

Sending JSON data using PHP's cURL library In PHP development, it is often necessary to interact with external APIs. One of the common ways is to use cURL library to send POST�...

See all articles