Saturday, April 13, 2013

XAMPP: Another web server daemon is already running / XAMPP: Another MySQL daemon is already running.


XAMPP: Another web server daemon is already running.
XAMPP: Another MySQL daemon is already running.



There are two ways to remove these errors.
1) Stop the running services
$ sudo service service-name stop
If you are using Debian or Ubuntu :
$ sudo service apache2 stop $ sudo service mysql stop
If you are using CentOS , RHEL or Fedora :
$ sudo service httpd stop $ sudo service mysqld stop

2) Kill the running services

Now here is the second method.

XAMPP-web server works on port 80 and XAMPP-MySQL works on port 3306.

We have to find the services of respective ports and kill them.

Run following command in terminal
$ sudo netstat -lnp | grep -e :80 -e :3306

It will show you all processes of port 80 & 3306 like this
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      15268/apache2   
tcp        0      0 0.0.0.0:3306            0.0.0.0:*               LISTEN      14699/mysqld 

Now kill them using
$ sudo killall -9 process-name

It shows the process name beside pid (process id). In above example pid is 15268 & process-name is apache2. Another pid is 14699 & process-name is mysqld.

To kill the above processes, Run
$ sudo killall -9 apache2 $ sudo killall -9 mysqld
Now if you start XAMPP, it does not give process running error.

But if it still gives, kill the running process again.

You can kill the processes using pid too.
$ sudo kill -9 pid

To kill the above processes, Run
$ sudo kill -9 15268 $ sudo kill -9 14699

#2002 - The server is not responding (or the local MySQL server's socket is not correctly configured)

phpMyAdmin is giving error
#2002 - The server is not responding (or the local MySQL server's socket is not correctly configured)

Probably there are two mysql running. Open the terminal and run
$ service mysql stop
or
$ service mysqld stop
(according to your Linux distribution)
Now restart lampp and try to open phpMyAdmin.

Make sure you have following code in your /opt/lampp/phpmyadmin/config.inc.php
$cfg['Servers'][$i]['connect_type'] = 'tcp';
If not, add above line in config.inc.php and Restart mysql.

If you are still facing the problem. Add this line in your config.inc.php too.
$cfg['Servers'][$i]['socket'] = '/var/run/mysql/mysql.sock';
and Restart mysql.

If you are still facing the problem, Make following changes in your config.inc.php

change 
$cfg['Servers'][$i]['host'] = 'localhost';
to 
$cfg['Servers'][$i]['host'] = '127.0.0.1';
Now restart mysql and open phpmyadmin.

If you are still facing the problem, check permission of the file /opt/lampp/phpmyadmin/config.inc.php, it should not be less than 755.
Set it to 755.
Run following command.
$ sudo chmod 755 /opt/lampp/phpmyadmin/config.inc.php
Now restart LAMPP and try to open phpmyadmin again.
http://localhost/phpmyadmin

XAMPP: Couldn't start MySQL

Remove Error : XAMPP: Couldn't start MySQL

Run following commands in terminal
$ sudo chown -hR root /opt/lampp $ sudo chmod -R 777 /opt/lampp $ sudo /opt/lampp/lampp restart
After running above commands when you try to start XAMPP and it gives following error :

"Warning: World-writable config file ‘/opt/lampp/etc/my.cnf’ is ignored"

To Remove above error, Run following command in terminal
$ sudo chmod 755 /opt/lampp/etc/my.cnf

After running above command when you try to start XAMPP again and it gives following error :

Wrong permissions on configuration file, should not be world writable!

To Remove above error, Run following command in terminal
$ sudo chmod 755 /opt/lampp/phpmyadmin/config.inc.php