启动Apache时提示错误“Cannot load php5apache2
启动Apache时提示错误“Cannot load php5apache2_2.dll into server” 故障现象: 在命令符方式下启动Apache时提示错误信息“Syntax error on line 122 of D:/Apache/conf/httpd.conf: Cannot load D:/PHP/php5apache2_2.dll into server”,导致Apache无法
启动Apache时提示错误“Cannot load php5apache2_2.dll into server”
在命令符方式下启动Apache时提示错误信息“Syntax error on line 122 of D:/Apache/conf/httpd.conf: Cannot load D:/PHP/php5apache2_2.dll into server”,导致Apache无法启动。
Apache的配置文件D:/Apache/conf/httpd.conf第122行内容为:
LoadModule php5_module D:/php/php5apache2_2.dll
PHPIniDir "D:/php"
注意:其中D:/PHP/php5apache2_2.dll是我安装php的相应路径。Apache为2.2.17版本,php为5.3.6版本。
出现错误的原因:
在网上查到一位朋友遇到类似情况,并提示根据PHP的安装文件名称“php-5.3.6-Win32-VC9-x86.zip”得知该版本的PHP安装文件是由VC编译完成的,因此如需要运行或调用该PHP压缩包中的相关文件,则需要首先安装VC的运行时环境。如果你的机器没有安装有VC运行时环境,则Apache调用该PHP压缩包中的相关文件时会提示如上错误信息。
解决方法:
在网上搜索“VC2008可再发行组件”或者是“VC2008运行库”,下载安装后即可解决此故障。
出现此错误的其他原因及解决方法:
原因:由于apache版本的不同,对应的“php5apache2.dll”也不同,如果你加载了错误的“php5apache2.dll”,则会提示该错误信息。
示例:假如你使用的是Apache2.2版的,则使用语句“LoadModule php5_module modules/php5apache2.dll”来加载PHP,就会出现该错误。这段代码的配置应该修改为“LoadModule php5_module modules/php5apache2_2.dll”或者“LoadModule php5_module "D:/php/php5apache2_2.dll"”。
总结:
Apache2.2 对应 php5apache2_2.dll
Apache2.1 对应 php5apache2.dll
Apache1 对应 php5apache.dll
由于上述原因,假设是安装了Apache2.2又安装了PHP5.0那就要出错了,在安装Apache和PHP时应该选择版本相对应的来进行配置安装。
http://bbs.chinaunix.net/thread-3581500-1-1.html
Windows下安装Apache2.2+PHP5.3+MySQL5.5.15
1. Apache 2.2
一路下一步安装即可。
2. PHP 5.3.6
官方目前只提供VC9编译的Thread Safe或Non Thread Safe版本。
作为开发使用,版本选择Thread Safe (window下一般开发环境用此版本即可,如果是以FastCGI来执行PHP时考虑到效率,需要采用None Thread Safe版本).
我习惯下载zip版本,即:php-5.3.6-Win32-VC9-x86.注意如果是在win2003/xp下运行php5.3 以上用vc9 编译的版本的话,有可能会遇到无法运行的情况,即双击php.exe 会弹出“由于应用程序配置不正确,应用程序未能启动”的问题,这是由于该版本的php采用vc9编译,而该win2003系统缺少运行库导致的,可以安装 Microsoft
2008 C++ Runtime (x86) 来保证运行。
问题:常见问题在配置apache里的httpd.conf 时 LoadModule php5_module 缺少 “php5apache2_2.dll” 的情况是因为下错了php版本,在Thread Safe版本下是具有php5apache2_2.dll的,而None Thread Safe版本 没有这个文件一般只用于fastcgi 所以不需要这个文件。
连结apache和php,修改apache的http.conf,新增下面的行:

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

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

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

To set up a CGI directory in Apache, you need to perform the following steps: Create a CGI directory such as "cgi-bin", and grant Apache write permissions. Add the "ScriptAlias" directive block in the Apache configuration file to map the CGI directory to the "/cgi-bin" URL. Restart Apache.

When the Apache 80 port is occupied, the solution is as follows: find out the process that occupies the port and close it. Check the firewall settings to make sure Apache is not blocked. If the above method does not work, please reconfigure Apache to use a different port. Restart the Apache service.

Apache connects to a database requires the following steps: Install the database driver. Configure the web.xml file to create a connection pool. Create a JDBC data source and specify the connection settings. Use the JDBC API to access the database from Java code, including getting connections, creating statements, binding parameters, executing queries or updates, and processing results.

The steps to start Apache are as follows: Install Apache (command: sudo apt-get install apache2 or download it from the official website) Start Apache (Linux: sudo systemctl start apache2; Windows: Right-click the "Apache2.4" service and select "Start") Check whether it has been started (Linux: sudo systemctl status apache2; Windows: Check the status of the "Apache2.4" service in the service manager) Enable boot automatically (optional, Linux: sudo systemctl

There are 3 ways to view the version on the Apache server: via the command line (apachectl -v or apache2ctl -v), check the server status page (http://<server IP or domain name>/server-status), or view the Apache configuration file (ServerVersion: Apache/<version number>).

To delete an extra ServerName directive from Apache, you can take the following steps: Identify and delete the extra ServerName directive. Restart Apache to make the changes take effect. Check the configuration file to verify changes. Test the server to make sure the problem is resolved.

How to view the Apache version? Start the Apache server: Use sudo service apache2 start to start the server. View version number: Use one of the following methods to view version: Command line: Run the apache2 -v command. Server Status Page: Access the default port of the Apache server (usually 80) in a web browser, and the version information is displayed at the bottom of the page.

How to configure Zend in Apache? The steps to configure Zend Framework in an Apache Web Server are as follows: Install Zend Framework and extract it into the Web Server directory. Create a .htaccess file. Create the Zend application directory and add the index.php file. Configure the Zend application (application.ini). Restart the Apache Web server.
