1

Using 22.04 on a laptop. I have XAMPP installed, but when I try to start XAMPP through Terminal, it says

Starting XAMPP for Linux 8.2.0-0... XAMPP: Starting Apache...fail. XAMPP: Another web server is already running. XAMPP: Starting MySQL...ok. 

I was puzzled because there is no reason Apache should be running on its own. So I shutdown the system and then started it again, and tried

sudo systemctl status apache2.service 

I got this and more saying Apache is running

● apache2.service - The Apache HTTP Server Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor prese> Active: active (running) since Tue 2023-12-26 21:18:54 IST; 50s ago Docs: https://httpd.apache.org/docs/2.4/ Process: 1136 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SU> Main PID: 1292 (apache2) Tasks: 55 (limit: 27942) Memory: 7.8M CPU: 41ms CGroup: /system.slice/apache2.service ├─1292 /usr/sbin/apache2 -k start ├─1293 /usr/sbin/apache2 -k start └─1294 /usr/sbin/apache2 -k start 

Is it possible to find out which / what is starting Apache and using it? I couldn't find anything under startup applications other than Nvidia X Server Settings and SSH Key Agent.

Is it a security issue? Should I be worried? What should I do? Thanks.

Edit 1 :

I should add that this XAMPP is been in use on this laptop for around 6 months now. I used sudo /opt/lampp/lampp start 2 days before too without any issues. Suddenly today, XAMPP won't start and giving this issue. That is why I am confused.

Edit 2 :

I checked the logs and found this

enter image description here

Edit 3 :

$ apt-cache policy apache2 apache2: Installed: 2.4.52-1ubuntu4.7 Candidate: 2.4.52-1ubuntu4.7 Version table: *** 2.4.52-1ubuntu4.7 500 500 http://in.archive.ubuntu.com/ubuntu jammy-updates/main amd64 Packages 500 http://security.ubuntu.com/ubuntu jammy-security/main amd64 Packages 100 /var/lib/dpkg/status 2.4.52-1ubuntu4 500 500 http://in.archive.ubuntu.com/ubuntu jammy/main amd64 Packages 

2 Answers 2

2

This is how a Debian system works and Ubuntu is derived from Debian.

Once you installed a service, the service will be started unless that very specific service is setup differently (which is really rare).

You can first stop it before trying to start XAMPP:

systemctl stop apache2 

or disable the auto-restart so on your next reboot it won't be running until you start it:

systemctl disable apache2 

At the same time, MySQL should also auto-start and thus on a reboot your XAMPP should be up and running on its own by default. There should be no need to start XAMPP at a later time.

6
  • Thanks. I should add that this XAMPP is been in use on this laptop for around 6 months now. I used sudo /opt/lampp/lampp start 2 days before too without any issues. Suddenly today, XAMPP won't start and giving this issue. That is why I am confused. Commented Dec 26, 2023 at 18:02
  • 1
    Did you install Apache directly or as an dependency from the Ubuntu sources? The shown systemd Service Units looks very much like it. Commented Dec 26, 2023 at 18:56
  • 1
    @user227495 That comment is something you need to add in your question. Otherwise, we'd have no idea! And a comment here won't be visible to the next person reading your question. Commented Dec 26, 2023 at 19:18
  • Comment added as edit to the original post. @noisefloor I installed XAMPP like 6 months ago on this machine based on some tutorial. I didn't install Apache directly as far as I know. The funny thing is there was no error like this 48 hours ago. Thanks. Commented Dec 27, 2023 at 5:15
  • 1
    Please add the output of apt-cache policy apache2 to our question. Commented Dec 27, 2023 at 10:26
2

The Edit 3 shows that you have Apache installed from the Ubuntu sources, too. So you have the manually installed version via XAMPP and the version installed from Ubuntu's sources. As the version installed from the sources is by default started automatically via a systemd Service Unit while the system starts, you cannot start another version of Apache manually at a later point.

You could remove the Apache installed from the sources

sudo apt remove apache2 

or stop the Apache from the sources and prevent that it is loaded as a dependency by another unit

sudo systemctl stop apache2.service sudo systemctl disable apache2.service sudo systemctl mask apache2.service 

However, prior to doing this you may want to find out why Apache was installed from Ubuntu's sources and if another package / program you are using maybe depends on a running Apache server.

Addition 1: To verify when the apache package was installed you can check the file /var/log/apt/history.log. This file holds information when which package was installed.

2
  • Thanks, exactly my problem. I did nothing that I understand about installing another version of Apache. This if happened, was in the last 2 days and I did nothing major during that period. Not sure what / which is responsible for the action. Commented Dec 28, 2023 at 13:10
  • 1
    @user227495: see addition 1 in my answer on how to determine when the Apache package was installed. Commented Dec 28, 2023 at 16:11

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.