17

I've been using XAMPP/Apache for a while and recently decided to install MySQL. However it seems that they are conflicting. MySQL seems to be taking preference, and it functioning correctly, however XAMPP/Apache is giving me this error message when attempting to start Apache:

03:07:32 AM  [Apache]   Attempting to start Apache app...
03:07:33 AM  [Apache]   Status change detected: running
03:07:33 AM  [Apache]   Status change detected: stopped
03:07:33 AM  [Apache]   Error: Apache shutdown unexpectedly.
03:07:33 AM  [Apache]   This may be due to a blocked port, missing dependencies, 
03:07:33 AM  [Apache]   improper privileges, a crash, or a shutdown by another method.
03:07:33 AM  [Apache]   Press the Logs button to view error logs and check
03:07:33 AM  [Apache]   the Windows Event Viewer for more clues
03:07:33 AM  [Apache]   If you need more help, copy and post this
03:07:33 AM  [Apache]   entire log window on the forums

I tried following the instructions here: http://www.complete-concrete-concise.com/web-tools/how-to-change-the-apache-port-in-xampp

And I've tried changing the document: httpd.conf in xampp/apache/conf

Changing 'Listen 80' to various things, and after restarting the application I had the same error message occur.

Would greatly appreciate any assistance in this matter. I'd prefer not to remove mySQL just to use XAMPP, but will if there is no way for them to both operate simultaneously.

Thanks in advance.

EDIT:

My reason for believing it is conflicting with MySQL is this:

03:26:51 AM  [mysql]    Problem detected!
03:26:51 AM  [mysql]    Port 3306 in use by ""C:\Program Files\MySQL\MySQL Server 5.6\bin\mysqld.exe" --defaults-file="C:\ProgramData\MySQL\MySQL Server 5.6\my.ini" MySQL56"!
03:26:51 AM  [mysql]    MySQL WILL NOT start without the configured ports free!
03:26:51 AM  [mysql]    You need to uninstall/disable/reconfigure the blocking application
03:26:51 AM  [mysql]    or reconfigure MySQL and the Control Panel to listen on a different port

I'm having some difficulties disabling mySQL temporarily to make use of XAMPP/Apache. Is there any way to change the ports so that they can co-exist?

EDIT 2:

Tried to follow instructions here: http://silentlyrun.blogspot.com.au/2013/02/how-to-change-apache-n-mysql-port-for.html

I encounter these error messages after:

09:13:22 AM  [main]     Initializing Modules
09:13:22 AM  [Apache]   Problem detected!
09:13:22 AM  [Apache]   Port 80 in use by "Unable to open process" with PID 4084!
09:13:22 AM  [Apache]   Apache WILL NOT start without the configured ports free!
09:13:22 AM  [Apache]   You need to uninstall/disable/reconfigure the blocking application
09:13:22 AM  [Apache]   or reconfigure Apache and the Control Panel to listen on a different port
09:13:22 AM  [Apache]   Problem detected!
09:13:22 AM  [Apache]   Port 443 in use by "Unable to open process" with PID 4084!
09:13:22 AM  [Apache]   Apache WILL NOT start without the configured ports free!
09:13:22 AM  [Apache]   You need to uninstall/disable/reconfigure the blocking application
09:13:22 AM  [Apache]   or reconfigure Apache and the Control Panel to listen on a different port

With these instructions, should the new port be the same? I assume so because they are both originally 80.

4. Search the string "Listen" in the file.
5. Replace port number 80 to any other unused port number.
6. Search for "ServerName" in the file.
7. Replace port number 80 to any other unused port number in the ServerName.

EDIT 3:

For a reason unknown to me, XAMPP/MySQL works without issue after a reinstall and port change from the silentlyrun.blogspot link above. However XAMPP/Apache is still giving issues:

09:32:14 AM  [Apache]   Error: Apache shutdown unexpectedly.
09:32:14 AM  [Apache]   This may be due to a blocked port, missing dependencies, 
09:32:14 AM  [Apache]   improper privileges, a crash, or a shutdown by another method.
09:32:14 AM  [Apache]   Press the Logs button to view error logs and check
09:32:14 AM  [Apache]   the Windows Event Viewer for more clues
09:32:14 AM  [Apache]   If you need more help, copy and post this
09:32:14 AM  [Apache]   entire log window on the forums
HoldOffHunger
  • 18,769
  • 10
  • 104
  • 133
carlvdm
  • 301
  • 1
  • 2
  • 9
  • I think you have open other applications that are the same ports as your XAMPP. Is your skype open? – aldrin27 Aug 24 '15 at 01:22
  • Thank you for responding. No I do not have Skype open, I've closed all non-essential applications and it is still giving that first mentioned error when I try restarting the application. Even when MySQL is closed through the Task Manager, I am still left with the issue. Regardless, thanks for your assistance. – carlvdm Aug 24 '15 at 01:32
  • XAMPP comes with its own installation of mysql which is why you are getting the 'port 3306' in use error. – dlporter98 Aug 24 '15 at 02:55
  • Can you simply try running this as an Administrator and see if that solves the issue? Generally any port <1000 requires admin access to bind. – Matt Clark Aug 24 '15 at 21:25

4 Answers4

67

To Resolve MySQL Port and Service conflict when already another MySQL Server is running, you need to follow following steps:-

  1. Close XAMPP Server

  2. Open file C:\xampp\mysql\bin\my.ini (C: is the default XAMPP Installation)

  3. Replace the port number 3306 with 3307

# password       = your_password  
port            = 3307
socket         = "C:/xampp/mysql/mysql.sock"

and

\# The MySQL server
[mysqld]
port= 3307
  1. Save the file and open XAMPP Control Panel (Run as Administrator, otherwise it will not allow following changes)

  2. In XAMPP Control Panel Click on Config > Service and Port Settings

  3. Goto MySQL Tab

  4. Change Service name mysql to mysqlxampp and Main port 3306 to 3307

  5. Click on Save then Save and close XAMPP

  6. Run Again XAMPP and you will be able to start the MySQL Server

You might also face issue with phpMyAdmin

For which you can add line

$cfg['Servers'][$i]['port'] = '3307';

in your config.inc.php file in phpMyAdmin root directory.

Ashish
  • 1,309
  • 1
  • 11
  • 17
4

If you have installed MySQL separately and also have XAMPP's MySQL running, then you will have this issue. The conflict is for port 3306 and not for port 80. I suggest you follow the guidelines mentioned here:

http://silentlyrun.blogspot.com.au/2013/02/how-to-change-apache-n-mysql-port-for.html

This worked for me when I had MySQL installed separately and also as a part of XAMPP.

sraje
  • 134
  • 1
  • 6
  • Thanks for the reply. I followed these instructions, yet it still shows me those error messages. Now however on startup it says this: Port 80 in use by "Unable to open process" with PID 4084! [Apache] Apache WILL NOT start without the configured ports free! [Apache] You need to uninstall/disable/reconfigure the blocking application [Apache] or reconfigure Apache and the Control Panel to listen on a different port AND Port 443 in use by "Unable to open process" with PID 4084! [Apache] Apache WILL NOT start without the configured ports free! – carlvdm Aug 24 '15 at 07:16
  • Seems like the old instance of XAMPP didn't shut down properly. Try killing process in the task manager. – A.O. Aug 24 '15 at 21:35
1

Restart your machine then use command line netstat. It will show you what application have ports open.

Arjang
  • 731
  • 1
  • 10
  • 19
0

I am answering this for someone who is finding this issue and want a better and fast solution.

Open task manager -> search 'mysqld' -> end task

tip: type 'm' to search faster.

My guess is that when you close xampp without stopping the running servers xampp doesn't stop these servers automatically and they remain running in the background.

But when you open the xampp again it fails to recognise these ongoing processes and considers them blocking the ports.