Home Backend Development PHP Problem How to solve the error problem of apache2.4 php5.6

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

Oct 15, 2021 am 09:08 AM
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配置文件
Copy after login

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 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)

PHP 8 JIT (Just-In-Time) Compilation: How it improves performance. PHP 8 JIT (Just-In-Time) Compilation: How it improves performance. Mar 25, 2025 am 10:37 AM

PHP 8's JIT compilation enhances performance by compiling frequently executed code into machine code, benefiting applications with heavy computations and reducing execution times.

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 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 Encryption: Symmetric vs. asymmetric encryption. PHP Encryption: Symmetric vs. asymmetric encryption. Mar 25, 2025 pm 03:12 PM

The article discusses symmetric and asymmetric encryption in PHP, comparing their suitability, performance, and security differences. Symmetric encryption is faster and suited for bulk data, while asymmetric is used for secure key exchange.

How do you retrieve data from a database using PHP? How do you retrieve data from a database using PHP? Mar 20, 2025 pm 04:57 PM

Article discusses retrieving data from databases using PHP, covering steps, security measures, optimization techniques, and common errors with solutions.Character count: 159

PHP Authentication & Authorization: Secure implementation. PHP Authentication & Authorization: Secure implementation. Mar 25, 2025 pm 03:06 PM

The article discusses implementing robust authentication and authorization in PHP to prevent unauthorized access, detailing best practices and recommending security-enhancing tools.

What is the purpose of prepared statements in PHP? What is the purpose of prepared statements in PHP? Mar 20, 2025 pm 04:47 PM

Prepared statements in PHP enhance database security and efficiency by preventing SQL injection and improving query performance through compilation and reuse.Character count: 159

What is the purpose of mysqli_query() and mysqli_fetch_assoc()? What is the purpose of mysqli_query() and mysqli_fetch_assoc()? Mar 20, 2025 pm 04:55 PM

The article discusses the mysqli_query() and mysqli_fetch_assoc() functions in PHP for MySQL database interactions. It explains their roles, differences, and provides a practical example of their use. The main argument focuses on the benefits of usin

See all articles