Deborah Emeni
Deborah Emeni's Blog

Deborah Emeni's Blog

A quick Guide to fixing errors encountered by beginners setting up the Database and Server in PHP with Linux OS

Deborah Emeni's photo
Deborah Emeni
·Nov 3, 2020·

3 min read

As a Beginner to backend web development with PHP, I had to install a Web Server like Apache and a database server like MySQL. There are various web servers for running PHP programs like WAMP and XAMPP but I chose to use XAMPP because it is supported in both Windows and Linux.

I used Ubuntu, a Linux Operating System, to install XAMPP and MySQL. After the installation, I encountered some errors while starting Apache and MySQL.


  • To start XAMPP, I ran this command in the terminal and got the following output:

    sudo /opt/lampp/lampp start

Screenshot from 2020-10-31 09.38.26.png Apache failed to start and it said another web server is already running. To fix this, simply run this command:

sudo netstat -nap | grep :80

You’ll see apache2 and there is 3–4 digit numbers before it, mine is 985

sudo kill [number]

Then restart the server with

sudo /opt/lampp/lampp start

Screenshot from 2020-10-31 10.13.38.png You'll see that your Apache server is now running.

  • The control panel starts right after installation of XAMPP in Ubuntu but I was unable to start the panel after I closed it. I also tried to search for XAMPP in my system but I could not find it. After a series of googling I found a command that starts the control panel for Ubuntu OS. I followed these steps:

  • In your terminal type,

    cd /opt/lampp/

  • Then list the files in that directory by running this in your terminal:

    ls Screenshot from 2020-10-31 10.32.49.png

  • You'll see a file in the list of files with a name, "", run this command:

    sudo chmod 755

You won't see any output on the screen.

  • The control panel will be opened immediately after running this last command:

    sudo ./ Screenshot from 2020-10-31 10.39.59.png

  • Another issue I had while setting up a project in php was the permission set on files by default in Ubuntu. In the path where xampp is located in Ubuntu


There you would find the 'htdocs' folder which will house all your php projects. You will not be granted access to create a folder in this directory


To fix this, run this command in your terminal

sudo chmod 777 -R /opt/lampp/htdocs

  • I also encountered this error with MySQL Screenshot from 2020-11-01 11.26.10.png To fix this, run this command in your terminal:

sudo service mysql stop

Then restart the server and run this command:

sudo /opt/lampp/lampp status

Refresh localhost/phpmyadmin Screenshot from 2020-11-01 11.33.16.png

Share this