How to Solve the Problem of Apache Not Starting - php

I want to open the server and set up the website, but Apache service is already available and still can't start.
I tried to enter httpd.exe-t and httpd.exe-k start in cmd, but neither could I.
win10
Listening port is Listen 8080
How can I open Apache in this way?
Doesn't it help to add pictures?
I didn't understand it at first.
Here are the error.log file
thanks
enter image description here

Related

Access to PHP script being denied by WAMP Server

I have thoroughly checked for an answer to this question but it seems like not one off the countless answers has helped me.
I would appreciate some guidance.
I have a website that I am accessing remotely via the clients public IP address. I have installed and configured WAMP Server with Apache 2.4.27. The machine is also running PHP 5.6.31.
What I am trying to do is allow a tax payer to upload supporting documentation to a folder using a script that I wrote called upload.php. I have tested the program on my local environment and it works. I should add that the bulk of the code for the website is written in a compiled dBASE executable that resides in the cgi-bin.
I am able to navigate to the page in which I allow the user to select a file and upload it, but when I click the upload button, I get an error message that states.
You don't have permission to access /upload.php on this server.
Apache/2.4.27 (Win64) PHP/5.6.31 Server at 24.148.115.174 Port 8000
I have configured my virtual host to allow access to the Wamp64/www directory.
I have no idea why this is not working. If you need to see the httpd.conf file, let me know. Thank you in advance.
try use: chmod 777 upload.php maybe your apache user don't have permission to access upload.php.
I feel foolish. My vhost.conf file was still set to
VirtualHost *:80.
I changed it to
VirtualHost *:8000
and that fixed the problem. Thank you to everyone for their advice.

instead of opening php, browser downloads php in Ubuntu

I installed php and apache2 correctly, I am able to open localhost/index.php. Index.php is located in /var/www.
However when I open port 8000 by python -m SimpleHTTPServer 8000, localhost:8000/index.php will not be opened, the browser will just to start to download it.
I also add Listen 8000 in ports.conf.
What else do I need to change to make it work properly?
One more question, what do I need to change make php work in all files not just /var/www?
Thanks
You're using python to respond to the HTTP request, not Apache, so Apache never gets a chance to execute index.php.
Try Google to learn how Apache works.
I just solve my problem. I edited apache2.conf and add 8000 port, then I change the document root to my home directory.

Apache is not running from XAMPP Control Panel ( Error: Apache shutdown unexpectedly. This may be due to a blocked port)

I have installed XAMPP (xampp-win32-1.8.2-0-VC9-installer.exe) on Windows 7 successfully. But unfortunately, the following error was found during running Apache from XAMPP Control Panel:
5:38:38 PM [Apache] Error: Apache shutdown unexpectedly.
5:38:38 PM [Apache] This may be due to a blocked port, missing dependencies,
5:38:38 PM [Apache] improper privileges, a crash, or a shutdown by another method.
5:38:38 PM [Apache] Press the Logs button to view error logs and check
5:38:38 PM [Apache] the Windows Event Viewer for more clues
5:38:38 PM [Apache] If you need more help, copy and post this
5:38:38 PM [Apache] entire log window on the forums
There are many possible answers for this problem. The most common and most likely is that you're running another program which is blocking port 80 or 443. If you've installed Skype, then you've found your problem! Change apache's port settings to 81 and apache will work. There's a good tutorial on that To check this you can open up your command line by clicking the start menu, and typing 'cmd', and enter the command
netstat -nab
this wil return a list of programs that will vaguely resemble this pattern
[someprogram.exe]
UDP [fe80::numbers:numbers:numbers:numbers%numbers]:portnumber
You need to find a line (or lines) ending in :80 and terminate them in order to start apache. If there is no line ending in :80, there are more things you can do.
First, navigate to xampp's directory (default is c:\xampp) and double click apache_start.bat. This will open up a comand line and return more detailed errors about why apache can't run. Mostly, be looking for syntax errors that you could've created by editing your httpd.conf, or httpd-ssl.conf files. This is very easy to do if you've edited it and are a new user.
If still this fails, your last hope is to check the apache error log by clicking on the logs tab in apache's row in the xampp control panel and clicking error log.
If none of this works, don't give up! You got this!
Edit: If you change the port of apache, you will also have to go into httpd.conf (located in xampp/apache/conf) and near line 184, replace
ServerName localhost:80
with
ServerName localhost:81
It is also possible to specify port 81 in the url of your localhost, i.e.
localhost:81/my_project.php
1. Go in xampp/apache/conf/httpd.conf and open it.
In the httpd.conf file at line 176 Replace
ServerName localhost:80
with
ServerName localhost:81
It will work.
Or 2. Even if the above procedure doesn't work. Then in the same file (httpd.conf) at line 45 replace
#Listen 0.0.0.0:80
#Listen [::]:80
Listen 80
with
#Listen 0.0.0.0:81
#Listen [::]:81
Listen 81
XAMPP Control Panel under Windows does not always reflect what is actually going on, unless you start it by "Run as administrator".
Go in xampp/apache/conf/httpd.conf and open it. Then just chang 2 lines
Listen 80
to
Listen 81
And
ServerName localhost:80
to
ServerName localhost:81
Then start using admin privileges.
As I am working in a corporate environment where developers faces firewall issues, none of the other answers resolved my issue.
As the port is not used by Skype, but by some other internal applications, I followed the below steps to resolve the issue:
Step 1 - From the XAMPP Control Panel, under Apache, click the Config button, and select the Apache (httpd.conf).
Inside the httpd.conf file, somehow I found a line that says:
Listen 80
And change the 80 into any number / port you want. In my scenario I’m using port 8080.
Listen 8080
Still from the httpd.conf file,
You should also do this in the same process
Still from the httpd-ssl.conf file, find another line that says
ServerName localhost:443
And change 443 to 4433.
ServerName localhost:4433
Remember to save the httpd.conf and httpd-ssl.conf files after performing some changes. Then restart the Apache service.
Have you executed "setup_xampp.bat" script? It's inside XAMPP folder and it must be executed every time you change XAMPP folder.
In my case the problem was that both port 80 and 443 were in use:
Steps to use to fix it are :
Open xampp and click on config button
Now click on ( Appache )httpd.conf (Open in notepad or other editor)
Now click ctrl + h.
Find 80 and replace with 8080
Now save and now click on Appache(httpd-ssl.conf).
Now find 443 and replace with 4430.
Now your xampp must be working fine as both these code are never in use by other programs on your system.
Now your localhost will be available as localhost:8080
Accompanying Timmay's answer, You need to do two changes-
Listen 80 --> Listen 81 (near line 58)
ServerName localhost:80 --> ServerName localhost:81 (near line 218)
If you are installed Skype, Please check this option.
Another case is Windows 10
Check this:
Go to Start, type in services.msc
Scroll down in the Services window
to find the World Wide Web Publishing Service.
Right-click on it, and select Stop or Disable it if you just want to use XAMPP only.
I have installed VMWare Workstation. So, It was causing the error.
Services.msc and stopped the 'Workstation' Services.
This has solved my problems.
Thanks
Check if you have Skype installed on your machine.
Login and go to Tools - Options - Advanced - Connection and uncheck the box which says use port 80
--
Check if Apache service is already installed by firing up services.msc from run command prompt.
How to delete a service from command prompt?
sc delete “serviceName”
Remember serviceName should be replaced by exact name of the Apache service as shown is services list.
Check if IIS is running and taking up port 80. If so, disable it.
--
Check if AVP (Kaspersky) is running and taking up port 80.
If so add httpd.exe as an exception to allowed programs.
--
Hope it helps.
go to C:xampp\apache\conf\extra\httpd-ssl.conf
Find the line where it says Listen 443, change it to Listen 4330 and restart your computer
[![enter image description here][2]][2]
i have found that similar issue on my system, and that was from skype installed before xampp installed. i got similar error. for fixing the error i followed these,
logged out to skype for a while ,
restarted apache from xampp control panel,
checked on browser, whether it worked or not, by http://localhost/
got it worked,
signed in again to skype,
all working great, as simple as that
i wasn't need nothing to install or uninstall, and this worked for me in less then 1 minute.
cheers
If You installed SQL Express or any .Net Server then you need to stop.
open cmd in administrator mode and type this line ...
net stop Was
now start apache
The Best way to do so:
The other methods explained above will get you stuck at a lot of places
Don't go for changing the port
2 Step Process
1) Open Command Prompt as Administrator
2) type net stop http (If it says it doesn't identify the keyword, then it is only because your Environmental Variable's PATH doesn't contain path to Program Files/System32 you can search on how to do it )
press Y at every place it asks you to, don't worry you are not stopping any important process just some process which took your port. And that process will again take over your port once you are not working.
If you face this issue directly after a complete new installation on Windows:
It seems like the setup program already starts the http.exe process and blocks the initial port 80 but does not reflect this state in the control panel.
To verify, just test for a running server in your browser. Type into your browser address bar:
localhost
If this displays the XAMPP dashboard, you're fine.
Alternatively, check the Task Manager for a running 'Apache HTTP Server' (httpd.exe) process.
You could stop the apache process with the xampp_stop.exe in your xampp base folder. Then, the XAMPP control panel should work as expected.
There can be lots of methods to solve this problem, but here is simplest one:
GO to XAMPP-control and...
Run as administrator
That's all..
This is the Golden Point for any such Abnormality.
Concept behind the work
Actually all the services in Xampp need Ports dependency.
What happens is, When there is no special powers given to xampp, it only look for some predefined ports to run those services. And, if in case, those ports are somehow already busy... eek! the service couldn't be started.
But if we give superpower to our Xampp-control (by running as administrator), it will somehow manage and for certainly on earth will run the services on the ports. And triumph! You made it.
Permanent tip for my dear Brother and Sisters
To do the efforts one and for all, follow these steps:
right-click on xampp-control.exe file and go to properties.
Go to Compatibility Tab.
In the settings below, choose the checkbox Run this program as an administrator.
Apply the changes. And you are done.
Now, every time you run the application, it will run with the Administrator status and You don't need to take care about the ports at all.
For my case, I didn't have htdocs folder in xampp folder. It seems that it requires htdocs folder to run so you can create an empty htdocs folder in the xampp folder.
Using XAMPP for laravel development currently.
I have skype installed on my desktop, which blocks port 80 and 443 (both of which Apache uses)
This fix worked for me:
1) Under C:\xampp\apache\conf\httpd.conf , search for Listen 80 and change to Listen 81
2) Under C:\xampp\apache\conf\extra\httpd-ssl.conf, search for Listen 443 and change to Listen 444
Had the same problem and none of the above solutions worked. So, by reading carefully the logs, I found this message :
10:55:42 [Apache] Port 443 in use by ""C:\Program Files (x86)\VMware\VMware Workstation\vmware-hostd.exe" -u "C:\ProgramData\VMware\hostd\config.xml"" with PID 1908!
In my case, I had just to stop the VMWare service which was running automatically.
The key is to read carefully the message given by XAMPP Panel when started.
Hope this help!
Run these commands in terminal and everything will work fine:
sudo /etc/init.d/apache2 stop
sudo /opt/lampp/lampp start
I have a solution. I had this problem and research a solution, but i did not succeed. So i downloaded a newer version of XAMPP and clicked on the option netstats within the program.There he gave me a list of programs and the ports they used and so I looked and had no program using port 80, but apache beyond 80 also uses port 443... and there was a program called Pando Media Boster this door, I started the task manager and finished the process of pando Average boster. Hope it helped :).
I also faced the same problem. And I found an easy and fast solution.
The only thing you need to do is to run XAMPP server as administrator everytime.
enter image description here
Probably you change configuration file in "httpd-ssl.conf"
<VirtualHost _default_:443>
DocumentRoot "D:/Server/xServer"
ServerName xyz.abc.com
SSLCertificateFile "conf/ssl.crt/xyz.crt"
SSLCertificateKeyFile "conf/ssl.key/sftaps.in.key"
</VirtualHost>
May be you change certificate name or something in Apache folder.
Even if you've configured Apache to listen on another port, you will still get this error if another program is using the default SSL port 443.
What you also need to edit is the http-ssl.conf file and alter the line
Listen 443 and change the port number there.
For me it was because of vmware (services-it has about 2 or 3 different services),stop it and every thing works fine
Use any method for which the server is working after that you can use this address to open the page on browser (if you've replaced the port 80 with 81 )
http://localhost:81/phpmyadmin/
just seeing this now since I have the same problem, but changing the port or any other answer didn't work for me.
Here's what was the problem - I've installed XAMPP to a custom location (eg. D:\Programming\XAMPP). Now, since the config files in xampp have simple locations (/xampp/mysql/data etc.) my services couldn't start.
So, I just had to rename all of those locations from /xampp/mysql/data to D:/Programming/XAMPP/mysql/data and now it's working.
for those of you who just manually activated windows defender Ransomware protection; it could be that your xampp folder or c:\ drive has been listed in the protected folder, and httpd.exe, php.exe was blocked from accessing it.
While it is most-likely the port blocking issue, you can always check if the settings of apache are correct:
Open command prompt and navigate to your apache installation bin folder: cd C:/xampp/apache/bin
Then run the following command to see if the syntax is OK:
httpd.exe -t
Running xampp as admin on windows 10 would be the simplest solution.

EasyPHP Cannot Connect to Localhost

I have had EasyPHP running on my system, but had to do a clean OS reinstall. Just downloaded and installed EasyPHP again, and Apache is running. But when I try to access the administrative page (127.0.0.1/home) through my web browser I get a "Oops! Google Chrome could not connect to 127.0.0.1" error.
I checked Apache's httpd file and it says it is listening on 127.0.0.1:80, which is exactly how I am trying to access the admin page through the browser. For some reason howver I am able to access the www folder with 127.0.0.1:8887.
I'm not very knowledgeable on EasyPHP so any help would be appreciated.
I had the same issue which was resolved by running the EasyPHP executable with admin privileges.
Update: I avoid installing EasyPHP into the Program Files folder and never had this issue again.
I was able to fix this problem by changing the listening port to 8887 like you did, but instead of saving it, do a 'Save As' and then overwrite it. It will ask you if you wish to overwrite the file, and just press 'yes'. This made the change permanent. Whenever I just saved it normally by pressing 'Save' instead of 'Save As', it would just create a new httpd file with the timestamp and not overwrite the original, which doesn't work.
Go to the Dashboard and change the port from 80 to 8080 then reverse to 80
Did you check apache error logs ?
In your easyphp toolbar you can see if apache is running (green icon)
By the way, try this command "netstat -b" and try to find "apache.exe" ( or "httpd.exe" depending of your easyphp version) listening on port 80.
But first, check your apache error logs, maybe there is a failure on your apache configuration files.
I had the same trouble today and when i tried to fix this changing the port by the EasyPHP program, this didn't resolve. If this occur try go to folder of the program/apache/conf and manually change httpd.conf.
Here the httpd of the program folder indicates 127.0.0.1:80 while httpd conf apache folder show 127.0.0.1:8887.
I hope had helped yours.
Regards

Apache and IIS 7 running together

I am working on windows 7. IIS 7 and XAMPP are installed on the same computer.
I have been playing with win host file and apache configuration files into to understand Server Root and directory.
I dont know where i messed up, that know when i type localhost it shows me IIS 7 screen and when localhost/xampp then apache screen.
How can IIS and apache run together at port 80 ? confused.
It is doable. The thing to keep in mind is that no 2 services can share the same port and IP address. Unfortunately, IIS takes over port 80 completely on the magic 0.0.0.0 address. What you need to do is re-bind apache and IIS to different IP addresses as well as remove the 0.0.0.0 binding. Not exactly sure how to get there on IIS7 (presuming you are running it given IE9 in the screenies), last time I pulled this stunt IIS6 was hawt.
A more sane option would be to setup a reverse proxy on 80 and have it hand stuff out to different web servers based on whatever rational criteria you want to use.
EDIT: found the magic juju, IIS7 post #44 - IIS7 and Apache on the same machine.
How To Run IIS And XAMPP Together On Same Machine
It is possible to run both IIS and XAMPP servers together on same machine by just changing the port number of any one of the server's. XAMPP-Apache and IIS both the server's uses the same port 80 to connect. In this post i am going to show you how to change the port number for the XAMPP-Apache server. Changing the port number for Apache server allows you to run both IIS and XAMPP server's on same machine using different port's.
Firstly, You need to know the folder where XAMPP is installed (root folder). The default folder is c:\xampp. From the root folder navigate to " apache\conf " folder and find the file "httpd.conf".
Before editing the file, make a backup of it with a name "httpd.conf.bak" so that if something goes wrong you can replace this file.
Now open the file "httpd.conf" with an editor like notepad. You need to make two edits to the file.
The first one:
Find out the below lines in the file.
#Listen 0.0.0.0:80
#Listen [::]:80
Listen 80
change it as shown below:
#Listen 0.0.0.0:80
#Listen [::]:80
Listen 8080
The second edit:
Find the below line:
ServerName localhost:80
change it to:
ServerName localhost:8080
You have finished changing the port number. Now restart your apache server from the xampp control panel and its ready to run.
Open your browser and and enter the address localhost:8080. You can see the root folder of apache opened. There is no need to make any changes to the IIS server and you an access it by just entering the address localhost in your browser.
In the above screenshot you can see the IIS server being accessed through localhost and XAMPP server through localhost:8080 on the same machine and even the same browser at a time.
In case of trying to get XAMPP (Apache) and IIS (5.1) working on WinXP this is what I did:
C:\xampp\apache\conf\httpd.conf:
Search for “Listen 80″, change to “Listen 8080″
Search for “ServerName localhost:80″, change to “ServerName localhost:8080″
C:\xampp\apache\conf\extra\httpd-ssl.conf
Search for “Listen 443″, change to “Listen 4499″
Search for “”, change to “”
Search for “ServerName localhost:443″, change to “ServerName localhost:4499″
[Then, access your Apache side by running localhost:8080 and ISS side by simple loccalhost]
It is possible to run both IIS and XAMPP on same machine by just changing the port number which is used by XAMPP server. Read this article to know how to change port number:
http://www.gooshareit.com/2012/03/how-to-run-iis-and-xampp-together-on.html
I have faced the same problem. However I have solved this way. I got it from here, it was really effective for me when all solutions were unable to provide me absolute solution.
Go to Control Panel > Administrative Tools > Click Services
Find “World Wide Web Publishing Service”
Right click and select “Stop”
Right click and select “Properties”, then change “Startup type” to “Manual”
If this doesn’t fix it, you can find out what is using port 80 as follows:
In a Command Prompt, run ‘netstat -ao > netstat.txt’ to write active connections and associated process IDs (PID) to a file (for me, there were too many to just view them in the command prompt)
Find the PID that is listening on port 80 (0.0.0.0:80) – for me, the PID was 4, which seems quite common
Open Task Manager (Ctrl + Shift + Esc), right click on the column headers, and then click PID to show the PID column. Sort by PID to find the process for the PID that you identified above.
Once you know the process that is causing the problem, a bit of Googling (other search providers are available) should help you fix it.

Categories