search
HomeBackend DevelopmentPHP ProblemHow to solve the error problem of apache2.4 php5.6

Apache2.4 php5.6 error solution: 1. Open the httpd.conf file and load the php configuration file; 2. Modify the configuration information in php.ini; 3. Specify the path to the expansion package.

How to solve the error problem of apache2.4 php5.6

##The operating environment of this article: windows7 system, PHP5.6 version, DELL G3 computer


Apache2.4 PHP5.6 configuration tutorial and solutions to problems such as the Apache service failing to start and the php configuration file not taking effect

When I first learned PHP, I used Apache2.2 php5.4 mysql5. 5 combination, because I am preparing to learn Laravel and have higher requirements on the PHP version, so I changed it to PHP5.6. At the same time, because Apache2.2 does not support PHP5.5 and above, I also need to change the Apache2.4 version. The following records the replacement process and commemorates the solutions to various problems encountered during the process.

First is the download of php5.6, no doubt, download the latest php5.6 in the upper right corner of the php official website (www.php.net),

here It is a windows environment. You need to click the last option of windows downloads,

and then select zip download. The download speed is generally OK. Here is 64-bit, and 32-bit is below. I can’t explain the diagram clearly. Check The results obtained from the data


After downloading, unzip it directly and rename the folder to php5 or php5.6 (optional, but remember, it will be useful later), I placed php5.

under wamp on the d: drive. The second step is to download Apache and enter the official website of Apache. You will find that you are confused and don’t know how to download. It seems that the official website only provides source code. , there is no compiled binary file, just put the download address http://httpd.apache.org/docs/current/platform/windows.html#down,


Visual inspection of these 5 is OK. The second one I chose feels that the download speed is normal. Look at the picture (pay attention to your own version)


Directly after downloading Unzip, here I put it in d:\wamp\Apache2.4, remember the folder name

. At this point, the download and installation is complete, and then the configuration process begins.

First of all, let me talk about a premise. After modifying the Apache and PHP configuration files, you need to restart the Apache server for it to take effect.

cmd Run the command line window in administrator mode, switch to the bin directory under the Apache directory, and execute the httpd -k install command to install the Apache service into the Windows service. If it is not run in administrator mode, an error will be reported.

Please note here that after executing the above command, if your Apache2.4 is not placed under c:\Apache24, an error will definitely be reported because the default path in the configuration file is inconsistent with the path you placed. , so here to change the httpd.conf file in the conf in the Apache directory, you can directly Ctrl F to search for c:\Apache24 and change all the default paths to your path, for example, here is d:\wamp\Apache2.4.

Then configure php to Apache, add the following lines of configuration to the many LoadModules in the httpd.conf file:

#加载PHP
LoadModule php5_module "D:/wamp/php5/php5apache2_4.dll"
#分配工作给php模块
AddType application/x-httpd-php .php .phtml
#加载php配置文件

PHPIniDir "D:/wamp/php5"

Pay attention to your path and the symbols/spaces in the code, it will almost never take effect. At this point, the configuration of Apache is completed. You can use the ApacheMonitor program or httpd.exe or cmd command in the bin directory in the Apache directory (httpd.exe -w -n "Apache2.4" -k start, this command can also display the error reason for startup failure) or in the windows service Start the Apache service. After normal startup, you can access localhost with your browser. If It Works appears, it means Apache is running successfully. You can create a new php file in the default website root directory (htdocs directory under the Apache directory) and write phpinfo() in it. ;, open the browser to view the php version information. If the normal display shows that php has been successfully added to Apache


Next configure php and change php.ini in the php directory -Copy the development file, rename it to php.ini and open it. First, let’s talk about a small problem encountered. If a warning appears under data when viewing the PHP version information


I only know that this is a PHP time zone problem. The solution is: modify the configuration information in php.ini as shown:


According to convention, some commonly used PHP extensions should be enabled below, generally including curl, mbstring, mysql, mysqli, PDO_mysql, etc. The method to enable them is to find a string of codes similar to extension=php_mysql.dll in php.ini, which will require Just remove the semicolon in front of the enabled extension. No explanation will be given.

A problem I encountered here is that after opening the extension, restarting the Apache server N times did not take effect! I once suspected that there was something wrong with the Apache configuration. After checking the information and constantly trying, I found a very low-level error, that is, php also has its default path c:\php. Anyway, it is on the c drive. I have the d drive here, so I need Specify the path of the extension package: extension_dir = "D:/wamp/php5/ext", and then find that the extension is finally enabled.


Since I have already installed Mysql5.5 before, I have forgotten the specific steps, so I won’t be stupid here.

To summarize, the most common problem I encountered during this upgrade process is that the default paths of Apache and PHP were not modified in time. Their default paths are all on the c drive. Generally, we will not change our own paths under Windows. The file is placed on the C drive, so I believe most people will experience these problems. I hope it will be helpful to you, and it will also be a reference for me to upgrade again in the future.

Recommended learning: "PHP Video Tutorial"

The above is the detailed content of How to solve the error problem of apache2.4 php5.6. For more information, please follow other related articles on the PHP Chinese website!

Statement
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
ACID vs BASE Database: Differences and when to use each.ACID vs BASE Database: Differences and when to use each.Mar 26, 2025 pm 04:19 PM

The article compares ACID and BASE database models, detailing their characteristics and appropriate use cases. ACID prioritizes data integrity and consistency, suitable for financial and e-commerce applications, while BASE focuses on availability and

PHP Secure File Uploads: Preventing file-related vulnerabilities.PHP Secure File Uploads: Preventing file-related vulnerabilities.Mar 26, 2025 pm 04:18 PM

The article discusses securing PHP file uploads to prevent vulnerabilities like code injection. It focuses on file type validation, secure storage, and error handling to enhance application security.

PHP Input Validation: Best practices.PHP Input Validation: Best practices.Mar 26, 2025 pm 04:17 PM

Article discusses best practices for PHP input validation to enhance security, focusing on techniques like using built-in functions, whitelist approach, and server-side validation.

PHP API Rate Limiting: Implementation strategies.PHP API Rate Limiting: Implementation strategies.Mar 26, 2025 pm 04:16 PM

The article discusses strategies for implementing API rate limiting in PHP, including algorithms like Token Bucket and Leaky Bucket, and using libraries like symfony/rate-limiter. It also covers monitoring, dynamically adjusting rate limits, and hand

PHP Password Hashing: password_hash and password_verify.PHP Password Hashing: password_hash and password_verify.Mar 26, 2025 pm 04:15 PM

The article discusses the benefits of using password_hash and password_verify in PHP for securing passwords. The main argument is that these functions enhance password protection through automatic salt generation, strong hashing algorithms, and secur

OWASP Top 10 PHP: Describe and mitigate common vulnerabilities.OWASP Top 10 PHP: Describe and mitigate common vulnerabilities.Mar 26, 2025 pm 04:13 PM

The article discusses OWASP Top 10 vulnerabilities in PHP and mitigation strategies. Key issues include injection, broken authentication, and XSS, with recommended tools for monitoring and securing PHP applications.

PHP XSS Prevention: How to protect against XSS.PHP XSS Prevention: How to protect against XSS.Mar 26, 2025 pm 04:12 PM

The article discusses strategies to prevent XSS attacks in PHP, focusing on input sanitization, output encoding, and using security-enhancing libraries and frameworks.

PHP Interface vs Abstract Class: When to use each.PHP Interface vs Abstract Class: When to use each.Mar 26, 2025 pm 04:11 PM

The article discusses the use of interfaces and abstract classes in PHP, focusing on when to use each. Interfaces define a contract without implementation, suitable for unrelated classes and multiple inheritance. Abstract classes provide common funct

See all articles

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

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools