I installed Apache on Windows 7 (localhost) and it worked fine. Then I went to download some other stuff and later noticed that the Apache server stopped. I went to command prompt (as administrator) and typed
net start apache2
It says «The Apache2 service is starting.» But before it finishes, I get the error
A service specific error occurred: 1.
It says that you can type in «NET HELPMSG 3547» for more info, but that doesn’t help at all.
Things I have tried:
- Quit Google Drive Sync
- Quit any and all programs using port 80 (port my server is on)
- Tried changing the port of the server and got same error message, so I don’t think it has anything to do with something else being in the port
None of those things have worked. I am confused at why it worked earlier, but now it won’t work.
random♦
14.5k9 gold badges53 silver badges58 bronze badges
asked Jun 10, 2014 at 21:48
2
You should check the Event Viewer for whatever shows up in the Windows Logs. Under the Application section there should be a list of errors with more details about what was exactly going wrong.
Recent example found:
The Apache service named reported the following error:
>>> Syntax error on line 523 of C:/Program Files/Apache Software Foundation/Apache2.2/conf/httpd.conf:
In the above example it was because a referenced drive was no longer on the system and Apache could not find it.
You can usually (at least in Windows Vista) find Event Viewer along the lines of:
Control Panel → Administrative Tools → Event Viewer
This should highlight any thing touching the system that you may have overlooked and provide further details and hints about what to tweak or change instead of just uninstalling everything.
answered Dec 19, 2015 at 18:06
random♦random
14.5k9 gold badges53 silver badges58 bronze badges
2
Apache server wouldn’t start after I downloaded coldfusion and added it to the server. I just uninstalled apache and coldfusion and reinstalled apache and it works fine now. The official error was that I added an extension(coldfusion) to apache and for some reason apache didn’t recognize it.
answered Jun 12, 2014 at 18:39
user2297366user2297366
1793 gold badges4 silver badges9 bronze badges
1
When I’m trying to start the Apache 2.2 server it is showing the following message: The Requested Operation has failed
In command Prompt it is showing as follows:
C:Documents and Settingsamth>net start apache2.2
The Apache2.2 service is starting.
The Apache2.2 service could not be started.
A service specific error occurred: 1.
More help is available by typing NET HELPMSG 3547.
asked Jun 24, 2014 at 9:57
1
Open run( win + r ) in windows and then type services.msc. Search for Apache service. Double click on the service and select any startup type other than disabled. This should work like a charm.
answered Mar 23, 2018 at 22:53
1
Open conf folder then open httpd.conf file in your text editor.
Find this line:
Listen 12.34.56.78:80
Listen 80
and change it to
Listen 12.34.56.78:80
Listen 8080
Then hit save
answered Jun 13, 2016 at 23:58
kupaffkupaff
3193 silver badges5 bronze badges
0
I have wasted a whole day on figuring out why curl_init()
threw an undefined-error. Im using Windows, Apache 2.4 and PHP 7.3
After trying to:
- Install a fresh version of Curl As described in this post
- Enabe Curl in the php.ini file following this description
I still got this error.
The solution was to add the directory of the php e.g c:php/ to the PATH Variable in the Windows environment variables.
->Hit the Windows-Key and S
-> search for "System"
-> go to advanced options(a small window shuld pop up)
-> hit environment variables
-> in the **bottom** box scroll until you find "PATH"
-> select it and hit "edit"
-> enter the php directory and close the window
-> reboot your PC
Hopefully it will work for you too
answered Sep 12, 2019 at 12:46
Have you done any changes in httpd.conf file ? i was also facing same problem in my case i have saved httpd.conf file as txt so due to that i was getting error
answered Sep 24, 2014 at 11:21
shreyshrey
7931 gold badge6 silver badges15 bronze badges
Was getting this issue when trying to start Apache with mod_jk. As part of loadmodule in http.conf file LoadModule jk_module modules/mod_jk.so was added but in Apache2.2modules folder mod_jk.so file was not available. Added mod_jk.so file to modules folder and apache started without any issues.
answered Sep 29, 2014 at 12:04
Here is what I did — if you uninstall and reinstall apache via command prompt it
httpd -k unistall/httpd -k install
then it displays the errors
in my case the require all was missing ‘granted’ at the end of to look like ‘require all granted’
<Directory />
AllowOverride all
Require all
</Directory>
answered May 13, 2015 at 19:03
succeedsucceed
82411 silver badges26 bronze badges
If your lan ip changed then you would come across this error. In the httpd conf file you to rectify the following:
Listen IP:Port
answered Oct 4, 2015 at 18:40
user3155354user3155354
631 gold badge1 silver badge11 bronze badges
I ran into the same error message on Windows Server 2008 R2. I was using SSL and realized that my signer certs, configured in ssl.conf, where placed in the wrong folders on the file system. I placed the certs in the correct spot and the service and Apache was working fine afterwards.
answered Jun 5, 2017 at 16:57
I’ve tried closing World Wide Web services, changing a lot of ports and surfing many forums, and eventually I looked in to Logs=>Apache (error.log) files.
I saw in this error:
PHP Fatal error: Directive ‘asp_tags’ is no longer available in PHP in Unknown on line 0
Then I opened php.ini files in XAMPP. Find with ctrl+f asp_tags=On
line and turn it to Off
.
All of it then worked.
David Buck
3,72335 gold badges31 silver badges35 bronze badges
answered Oct 13, 2020 at 10:13
In my case Apache 2.4 is worked on Win7Pro 64bit. Last week it worked fine but today I was unable to start it as usually. I tried to check logs for errors but no clue. Then I went to Control panel -> Administrative tools -> Services and found there Apache service was disabled!? Click on property, set Startup type to manual and — voila! It started like charm.
answered Jun 10, 2016 at 16:32
Ludus HLudus H
2392 silver badges15 bronze badges
Hi,
after making changes to httpd.conf I want to restart Apache as service in Xampp. I removed it first as per Nelson’s advice:
sc delete apache2.2
When I check svc on the xampp control panel the service apparently restarts, i.e. I can successfully delete it again with the forementioned command, but on the Xampp control panel it says «stopped» (gray on a gray background). Clicking «start» doesn’t change things, though I get a message «Apache service started».
In httpd.conf I changed DocumentRoot, but Apache doesn’t seem to see the changes, though it seems to be running. At least I get a page for http://localhost, but not the page the new DocumentRoot refers to.
Any idea of what’s wrong here?
TIA
Steven
edit
When I try to start Apache using the Services Console I get an error «Windows could not start the Apache2.2 on Local Computer, patatee, patata…». The error log mentions event 3299.
«sc delete» deletes a Windows service, that is the service no longer exists and can’t be started, stopped or whatever. The service wouldn’t be recreated until you reinstall Apache or use the sc command to recreate the service. The corretc way to restart the service from the command line would have been:
net stop apache2.2
net start apache2.2
(annoyingly there is not a «net restart» option).
If you use «net start apache2.2» does it return an error? If you get an error «The service name is invalid.» then you need to recreate the service. I don’t know how to do this offhand but it should be straightforward.
JR
A service specific error occurred: 1
This indicates the Apache service is installed, but Apache itself is reporting an error when it starts. Possibly something wrong with it’s config files. The usual tactic is to try running Apache as an application so you can see any error messages it produces. See http://httpd.apache.org/docs/2.2/platform/windows.html#wincons for stuff on running Apache as an application.
I’ve never used XAMPP’s Control Panel. But when I last used XAMPP, I eventually found the easiest way to restart Apache was through Window’s regular Services console.
I know this doesn’t directly answer your question, but I recommend installing apache/php/perl/mysql by hand. This will enable you to:
- understand how these components are linked
- change component version as needed (some projects may require different versions)
- start these components in console — this will help you debug and controll better
- you can have several installations for different projects — this way it’s easy to throw away an installation, and rebuilt it, without affecting the other projects
Tools like XAMPP are great to quickly have an installation at hand; but they are not without faults. While the promise of integration is appealing, most of the time you will have to do it by hand — and it’s a more powerfull aproach.
If you need to mess with windows services, I recommend this great free tool: Windows Service Commander.
[Oh, great! Since it was moved here from stackoverflow, I can’t edit my own message!]
I tried «net start apache2.2», but it says
The Apache2.2 service could not be started
A service specific error occurred: 1.
More help is available by typing NET HELPMSG 3547.
The command in the last line didn’t give any more information.
@John:
I realize I can’t start a service which isn’t running, but I thought that was what the svc-checkbox on the xampp control panel was for. When checking it a dialog «Click OK to install the Apache Service» is shown, and when I do it says «Apache service started».
1
You can also restart the apache service directly through the apache executable, and you have a -k reload/restart option.
apache2.exe -k restart -n «apacheservicename»
Iirc.
Здравствуйте,
Запустил веб сервер apache2 на raspberry pi 3b (система Raspbian). По началу все работало нормально, но спустя 3 дня сайт перестал работать.
Apache2 показывает ошибку:
Apr 19 15:55:53 raspberrypi systemd[1]: apache2.service: Control process exited, code=exited status=1
Apr 19 15:55:53 raspberrypi systemd[1]: Failed to start The Apache HTTP Server.
Apr 19 15:55:53 raspberrypi systemd[1]: apache2.service: Unit entered failed state.
Apr 19 15:55:53 raspberrypi systemd[1]: apache2.service: Failed with result 'exit-code'.
Если перезагрузить apache появляется следующее сообщение
Job for apache2.service failed because the control process exited with error code.
See "systemctl status apache2.service" and "journalctl -xe" for details.
journalctl -xe пишет:
-- Unit apache2.service has failed.
--
-- The result is failed.
Apr 19 16:27:48 raspberrypi systemd[1]: apache2.service: Unit entered failed sta
Apr 19 16:27:48 raspberrypi systemd[1]: apache2.service: Failed with result 'exi
Apr 19 16:27:48 raspberrypi sudo[2123]: pam_unix(sudo:session): session closed f
Apr 19 16:39:01 raspberrypi systemd[1]: Starting Clean php session files...
-- Subject: Unit phpsessionclean.service has begun start-up
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- Unit phpsessionclean.service has begun starting up.
Apr 19 16:39:01 raspberrypi CRON[2200]: pam_unix(cron:session): session opened f
Apr 19 16:39:01 raspberrypi CRON[2205]: (root) CMD ( [ -x /usr/lib/php/sessionc
Apr 19 16:39:01 raspberrypi CRON[2200]: pam_unix(cron:session): session closed f
Apr 19 16:39:01 raspberrypi systemd[1]: Started Clean php session files.
-- Subject: Unit phpsessionclean.service has finished start-up
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- Unit phpsessionclean.service has finished starting up.
--
-- The start-up result is done.
lines 2223-2245/2245 (END)
-- Unit apache2.service has failed.
--
-- The result is failed.
Apr 19 16:27:48 raspberrypi systemd[1]: apache2.service: Unit entered failed state.
Apr 19 16:27:48 raspberrypi systemd[1]: apache2.service: Failed with result 'exit-code'.
Apr 19 16:27:48 raspberrypi sudo[2123]: pam_unix(sudo:session): session closed for user root
Apr 19 16:39:01 raspberrypi systemd[1]: Starting Clean php session files...
-- Subject: Unit phpsessionclean.service has begun start-up
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- Unit phpsessionclean.service has begun starting up.
Apr 19 16:39:01 raspberrypi CRON[2200]: pam_unix(cron:session): session opened for user root by (uid=0)
Apr 19 16:39:01 raspberrypi CRON[2205]: (root) CMD ( [ -x /usr/lib/php/sessionclean ] && if [ ! -d /run/systemd/system ]; then /usr/lib/php/sessionclean; fi)
Apr 19 16:39:01 raspberrypi CRON[2200]: pam_unix(cron:session): session closed for user root
Apr 19 16:39:01 raspberrypi systemd[1]: Started Clean php session files.
-- Subject: Unit phpsessionclean.service has finished start-up
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- Unit phpsessionclean.service has finished starting up.
--
-- The start-up result is done.
~
Браузер показывает ошибку: ERR_CONNECTION_REFUSED
Сайт, который крутится на сервере: arian.ml
Заранее буду благодарен, если поможете решить проблему.
Introduction
Apache. The name no software guy is unfamiliar with. In the simplest of terms, it is the most widely used web-server for running and maintaining websites on the Internet. It is responsible for directing users on the internet to the desired HTTP directory. Given that it’s so popular, it still stands on its name while being free and open-source. How cool is that?
Despite how cool it sounds, I’m about to tell you something dreadful. With popular programs come popular error messages, and one such is the “failed to start apache http server” message. Don’t be disheartened just yet! Because the fix itself is way easier than running the server itself. If you can get your guts to run the server, you can fix the problem like so. All it takes is just a bit of understanding!
In this article, we’ll try to break down the possible causes for encountering this error message, and provide you with their fixes all along.
Possible causes for ‘failed to start the apache http server’
No directory present for Apache Log files
The first possible reason for the failure of starting the apache http server is due to the absence of the log file directory for apache. Log files are extremely crucial for server management tools, which is why not having this directory straight out means that the apache server will be unable to run. This directory should usually be created automatically when you install apache.
In many cases, it is possible that a disk-cleanup utility may have removed those log files, stating them as unnecessary. There sure are programs that have faint use of log files, but it isn’t the same for server management tools. Which is why you will need to create that directory.
Port is already occupied
The other very, very common reason for the error message to occur is that some other program is already occupying the same port, which apache is trying to use. The default port that apache tries to use is 80, but apache is not alone. Other tools like nginx also use the port 80 by default. This is because 80 is actually the default port for HTTP itself.
Therefore, in order for apache to run, you either need to remove the program which is occupying port 80, or change the port of either apache or the other program so as to avoid conflicts and start the server smoothly.
How to fix ‘failed to start the apache http server’
Restart the Apache Server
The first thing you’d like to do before anything else is to see if restarting the apache server works out. This could help out in certain cases, and for many could turn out to be the only fix they require to abolish the error message. The best way to do this is to fully stop the server and than start it again, rather than using restart command:
$ sudo systemctl stop apache2.service
$ sudo systemctl enable apache2.service
$ sudo systemctl start apache2.service
If you don’t encounter any error while trying to use the above commands, then you have properly started the apache http server without any further errors. Also, notice the fact that I wrote apache2 instead of just apache. This is because the latest version of apache is above 2, so the service name has now changed to apache2 as well. If you’re using an older version, it is probably a good idea to switch. If you don’t want that, then make sure to type apache.service instead of apache2.service in the above commands.
If the above hasn’t worked for you, try out the other methods that are discussed below.
Create the directory for log files
As mentioned previously, not having the directory where the log files for apache are saved means that you’ll not be able to start the apache server. To fix this, simply create the directory by running:
$ mkdir -p /var/log/apache2
This should create the directory you’re looking for. However, if you’re using this command as a different user other than root, you’d see that the terminal is giving an output saying “permission denied”. Which is why, you will first need to login to the root user. Or else, you can also use the sudo command before to give superuser privileges to your current user. Try running the below command:
$ sudo mkdir -p /var/log/apache2
Now try starting the apache server once again to see if it works, by running:
$ sudo systemctl start apache2.service
If you see no error messages this time around, then you’ve successfully surpassed the error message! If fortune did not turn out to be true, and you still see errors, it probably means that this is not the issue, or at least, not the only issue.
Stop/remove the program occupying the port
There are several ways to look into this solution for fixing the error message. The goal of this is to free up port 80 so that Apache can use it to run the server. But first, you need to figure out which program is actually occupying port 80. To do this, install a program called net-tools. If you’re using Ubuntu: you’d use the following command:
$ sudo apt-get install net-tools
Once the tool is installed, run the below command to see which program is occupying port 80:
$ sudo netstat -antup | grep 80
For example, look what I found in my case:
In the above image, I can see that port 80 is being occupied by the nginx server. So there are two things I could do to remove it’s occupation:
- Remove the Program entirely
- Disable it for a certain period
- Change the port for Apache
The choice is for you to make, for yourself. But I’ll show you all three.
The first option is to remove the program entirely. If you think that you don’t actually need the other program which is being used, you can remove it, by first figuring out its name like I did previously using the netstat command, and then use your package manager. In my case, it was nginx, so I’d use the following command to remove it:
$ sudo apt-get --purge remove nginx
Now try starting the apache server once again to see if it has worked out for you.
The next option is to disable the other program, for now at least. If you think you need to use both, at different intervals, then you can disable and enable the servers according to your demand. But if you wish to run them simultaneously, then you’ll need to change the port of at least one of the programs. For now, I’ll use the following commands respectively to disable nginx, to free up port 80:
$ sudo systemctl stop nginx
$ sudo systemctl disable nginx
Once I’ve disabled it, now look what happens when I try out the netstat command once again:
$ sudo netstat -antup | grep 80
As you’d have probably noticed by now, the command returns you no output, as there is no program occupying port 80 at present.
Simple start the apache server now by running:
$ sudo systemctl start apache2.service
You should now successfully be able to start the apache http server without any further issues.
There’s one last option that I’m left to show you, that is, to change the port for Apache. Though nor recommended, you can do this to run different servers at the same time, in case you need them all.
Change the port for Apache
To change the port for Apache, first stop the apache server, bu running:
$ sudo systemctl stop apache2.service
Then, open up the ports.conf file using a text editor like nano, by using:
$ sudo nano /etc/apache2/ports.conf
inside this file, change the number 80 after listen to the port number you like. here, I’d like to use 8080, which should look something like this:
Once you’ve edited this file, you also need to make changes to the 000-default.conf file, located under the sites-enabled directory, so that the websites can recognise this new port. Open the file by running:
$ sudo nano /etc/apache2/sites-enabled/000-default.conf
Inside this file, you’d need to change the very first line, and change the number 80 to the new port, which in my case is 8080. After being changed, it should something like the one below:
After everything is set, try starting the server once again too see if the changes have taken effect:
$ sudo systemctl start apache2.service
This time around, if you use the same netstat command as previous, this is what you should be seeing if the changing was a success:
$ sudo netstat -antup | grep 80
Wala! Changing the port was a definite success! Now let’s take things to the minimal-extreme by checking if we can run nginx along with this server, both together. Once I start the nginx server once again, and when I ran netstat, look what I found:
Conclusion
Wohoooo! We now have both the servers up and running, without any conflicts, as well as without any error messages! As always, the choice is yours. If you think you need both of the servers, then using this method should probably be the correct way to do so. Otherwise, if you think that you only need apache, then taking this method is probably quite meaningless. But beware! It is also possible that some other application you’re running needs the other server to be run as well. So make sure you don’t remove it before clarifying that!