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

藏色散人
Release: 2023-03-13 10:04:01
Original
2505 people have browsed it

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!

Related labels:
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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!