Home php教程 php手册 Apache服务器无法使用的解决方法

Apache服务器无法使用的解决方法

Jun 13, 2016 am 11:52 AM
apa apache iis one occupy reason method server use port solve Thunder

原因一:80端口占用例如IIS,另外就是迅雷。我的apache服务器就是被迅雷害得无法启用!

原因二:软件冲突装了某些软件会使apache无法启动如Dr.com 你打开网络连接->TcpIp属性->高级->WINS标签把netbios的lmhosts对勾去掉,禁用tcp/ip的netbios. 然后再启动应该就可以了。


原因三:httpd.conf配置错误如果apache的配置文件httpd.conf搞错了,在windows里启动它,会提示the requested operation has failed,这是比较郁闷的事,因为查错要看个半天。其实可以用命令行模式启动apache,并带上参数,apache会提示你哪句有误,然后就可以针对性的解决。

检查错误方法
 
     进入cmd 然后进入 Apache安装目录(具体为你自己的安装目录)\bin> httpd.exe -w -n "Apache2" -k start (引号中的Apache2修改为你的Apache服务名,我的是2.2.4版,服务名就是Apache2,可以到计算机服务里找)

     提示133行有问题时(提示:Syntax error on line 133 of ...........),打开Apache安装目录\conf\httpd.conf 找到第133行的ServerAdmin (没有工具确定行数的按ctrl+F 用"ServerAdmin"关键字查找,一般会有两个,下面那个就是)这行在其后空一格,随便加个名字,例如,加上abc后,就可以解决了.

     如果是端口占用(提示:(OS 10048)通常每个套接字地址(协议/网络地址/端口)只允许使用一次。),先退出Apache,在httpd.conf中搜索Listen 80 ,将80改成8080或者别的端口号,重新运行一下Apache,这下应该能够启动了.

网站根目录设置不对解决方法


如果是网站根目录设置不对也会启动不了,Apache事还真多.有两处。在httpd.conf中查找 Apache/htdocs .修改即可,如K:/IDDCWEB/wwwroot。一般文件地址的“\”在Apache里要改成“/”。如果用的Apache2.24版本,要选择php中的php5apache2_2.dll加载.

下面附加自己修改httpd.conf的一些设置.供大家参考比较。

1.改网站根目录,有两处。查找 DocumentRoot 和 Directory.修改即可,如D:/wwwroot;主要是一般文件地址的“\”在Apache里要改成“/”。

2.首页设置,DirectoryIndex,添加相关首页项即可,如index.php ihdex.htm

3.查找LoadModule ssl,在下面加两行,第一行“LoadModule php5_module。D:/Server/php/php5apache2_2.dll”是指以module方式加载php,第二行“PHPIniDir "D:/php"”是指明php的配置文件php.ini的位置,是当然,其中的“D:/php”要改成你先前选择的php解压缩的目录。

4.查找AddType application/x-gzip .gz .tgz,在下面加入“AddType application/x-httpd-php .php”、“AddType application/x-httpd-php .html”两行,你也可以加入更多,实质就是添加可以执行php的文件类型,比如你再加上一行“AddType application/x-httpd-php .htm”,则.htm文件也可以执行php程序了,你甚至还可以添加上一行“AddType application/x-httpd-php .txt”,让普通的文本文件格式也能运行php程序。

5.搜索ServerName   修改网站名字后面的端口为前面改过的端口,如果没改过,省略.


D:\Program Files\Apache2.2\bin>httpd -t。[Wed Jun 22 14:34:49 2011] [warn] module php5_module is already loaded, skipping Syntax error on line 503 of D:/Program Files/Apache2.2/conf/httpd.conf:
PHPINIDir takes one argument, Directory containing the php.ini file。这个很简单,用记事本打开“D:/Program Files/Apache2.2/conf/httpd.conf”,你是否看到倒数几行有一个【PHPIniDir ""】。报错的原因是双引号里面缺少一个参数。

解决办法:
找到你的php安装目录,比如我的是D:/Program Files/PHP,你只需要在上面的双引号加入"D:/Program Files/PHP/php.ini"

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

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

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 to set font size on mobile phone (easily adjust font size on mobile phone) How to set font size on mobile phone (easily adjust font size on mobile phone) May 07, 2024 pm 03:34 PM

Setting font size has become an important personalization requirement as mobile phones become an important tool in people's daily lives. In order to meet the needs of different users, this article will introduce how to improve the mobile phone use experience and adjust the font size of the mobile phone through simple operations. Why do you need to adjust the font size of your mobile phone - Adjusting the font size can make the text clearer and easier to read - Suitable for the reading needs of users of different ages - Convenient for users with poor vision to use the font size setting function of the mobile phone system - How to enter the system settings interface - In Find and enter the "Display" option in the settings interface - find the "Font Size" option and adjust it. Adjust the font size with a third-party application - download and install an application that supports font size adjustment - open the application and enter the relevant settings interface - according to the individual

How to choose a mobile phone screen protector to protect your mobile phone screen (several key points and tips for purchasing mobile phone screen protectors) How to choose a mobile phone screen protector to protect your mobile phone screen (several key points and tips for purchasing mobile phone screen protectors) May 07, 2024 pm 05:55 PM

Mobile phone film has become one of the indispensable accessories with the popularity of smartphones. To extend its service life, choose a suitable mobile phone film to protect the mobile phone screen. To help readers choose the most suitable mobile phone film for themselves, this article will introduce several key points and techniques for purchasing mobile phone film. Understand the materials and types of mobile phone films: PET film, TPU, etc. Mobile phone films are made of a variety of materials, including tempered glass. PET film is relatively soft, tempered glass film has good scratch resistance, and TPU has good shock-proof performance. It can be decided based on personal preference and needs when choosing. Consider the degree of screen protection. Different types of mobile phone films have different degrees of screen protection. PET film mainly plays an anti-scratch role, while tempered glass film has better drop resistance. You can choose to have better

Introduction to the specific process of setting up Thunder downloads in Google Chrome Introduction to the specific process of setting up Thunder downloads in Google Chrome May 09, 2024 pm 01:01 PM

First install Google Chrome and Thunder software. After installation, open Google Chrome and click on the Settings option. Then we select the extension in the settings options. Because we want to enable Thunder downloads, which is generally not available here, so click below to get more extensions. Then we enter Google's online app store and enter [Thunder] in the search box and select the first related search in the drop-down box. At this time, we find the extension column in the display results, and then find thunderdownload extension for chrome. Then click Free on the right to download and install. Then it will be displayed after the addition is successful. Next, enter the extension program. You will find that the newly added Thunder extension program is enabled, indicating that

What should I do if the video format does not support playback? Recommended video players that support many formats What should I do if the video format does not support playback? Recommended video players that support many formats May 09, 2024 am 08:19 AM

What should I do if the video format does not support playback? This situation usually occurs because the player lacks the corresponding decoding package. The video player that comes with the Windows system can support relatively few formats. It cannot play certain niche video formats. It is recommended that you download them here. KMPlayer software, after installation, the built-in decoder supports most video formats. KMPlayer is a professional and practical all-round audio and video player tool. KMPlayer supports video playback in various common formats and can be used to play local videos smoothly without lag. Question: What are the commonly used shortcut keys for KMPlayer? Answer: Software color adjustment increases U and decreases T. (Used when using the built-in decoder of kmp player)

How to conduct concurrency testing and debugging in Java concurrent programming? How to conduct concurrency testing and debugging in Java concurrent programming? May 09, 2024 am 09:33 AM

Concurrency testing and debugging Concurrency testing and debugging in Java concurrent programming are crucial and the following techniques are available: Concurrency testing: Unit testing: Isolate and test a single concurrent task. Integration testing: testing the interaction between multiple concurrent tasks. Load testing: Evaluate an application's performance and scalability under heavy load. Concurrency Debugging: Breakpoints: Pause thread execution and inspect variables or execute code. Logging: Record thread events and status. Stack trace: Identify the source of the exception. Visualization tools: Monitor thread activity and resource usage.

How to add a server in eclipse How to add a server in eclipse May 05, 2024 pm 07:27 PM

To add a server to Eclipse, follow these steps: Create a server runtime environment Configure the server Create a server instance Select the server runtime environment Configure the server instance Start the server deployment project

Application of algorithms in the construction of 58 portrait platform Application of algorithms in the construction of 58 portrait platform May 09, 2024 am 09:01 AM

1. Background of the Construction of 58 Portraits Platform First of all, I would like to share with you the background of the construction of the 58 Portrait Platform. 1. The traditional thinking of the traditional profiling platform is no longer enough. Building a user profiling platform relies on data warehouse modeling capabilities to integrate data from multiple business lines to build accurate user portraits; it also requires data mining to understand user behavior, interests and needs, and provide algorithms. side capabilities; finally, it also needs to have data platform capabilities to efficiently store, query and share user profile data and provide profile services. The main difference between a self-built business profiling platform and a middle-office profiling platform is that the self-built profiling platform serves a single business line and can be customized on demand; the mid-office platform serves multiple business lines, has complex modeling, and provides more general capabilities. 2.58 User portraits of the background of Zhongtai portrait construction

Equipped with AMD EPYC 4004 series processors, ASUS launches a variety of server and workstation products Equipped with AMD EPYC 4004 series processors, ASUS launches a variety of server and workstation products Jul 23, 2024 pm 09:34 PM

According to news from this website on July 23, ASUS has launched a variety of server and workstation-level products powered by AMD EPYC 4004 series processors. Note from this site: AMD launched the AM5 platform and Zen4 architecture EPYC 4004 series processors in May, offering up to 16-core 3DV-Cache specifications. ASUSProER100AB6 server ASUSProER100AB6 is a 1U rack server product equipped with EPYC Xiaolong 4004 series processor, suitable for the needs of IDC and small and medium-sized enterprises. ASUSExpertCenterProET500AB6 workstation ASUSExpertCenterProET500AB6 is a

See all articles