Score:0

Updating php but cannot restart apache

nf flag

I try to update my php version to php7.4 and when I use php -v it is successfully updated. However it doesn't work on my wordpress. And my apache can't be restarted.

I have mutiple sites in my vestacp. When I look into the apache state by sudo systemctl status apache2, I get the following. Thank you very much for helping.

apache2.service - The Apache HTTP Server
Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)  
Drop-In: /lib/systemd/system/apache2.service.d
           └─apache2-systemd.conf
Active: failed (Result: exit-code) since Sun 2023-01-01 18:06:26 HKT; 4min 49s ago

AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 2400:8902::f03c:93ff:fecd:b912. Set the 'ServerName

(98)Address already in use: AH00072: make_sock: could not bind to address [::]:80

(98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80

no listening sockets available, shutting down

AH00015: Unable to open logs

Action 'start' failed.

The Apache error log may have more information.

apache2.service: Control process exited, code=exited status=1

apache2.service: Failed with result 'exit-code'.

Failed to start The Apache HTTP Server.
Score:1
cn flag

The error messages basically spell out what the (immediate) problem ist: The Apache server needs to bind to port 80, but something else is already using that port. So the Apache server can't bind to the port and therefore can't start.

(98)Address already in use: AH00072: make_sock: could not bind to address [::]:80

(98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80

So the next step would be to check what exactly is occuping port 80. This could be a previous instance of the Apache server that you thought you stopped but didn't. This could be some other software, or whatever else.

One way to check what's running on a port is to use the tool netstat

netstat -nap tcp | grep -i ':80'

This has netstat list all TCP ports that are currently "in use". Then you filter this list with grep. The output could be something like

tcp6       0      0 :::80                   :::*                    LISTEN      392476/apache2

This shows you that TCP port 80 with IPv6 is bound to process 392476, and this process is identified as apache2. From there, you need to look further into what this process actually is, whether you want it to be there or not and what to do about it.

As a general remark, it is useful to actually read the error messages ;) Quite often they literally spell out what the problem is, or at least where to start probing. From my experience, many people don't go beyond "There's some kind of error message, why bother to read it, somebody help!!!" ;) But those messages are often very useful, as you hopefully seen here.

Bruce avatar
nf flag
Thank you Henning. I just try the code and it responds the following. I am a beginner to seek help. Thank you very much 'root@ProFaith:~# netstat -nap tcp | grep -i ':80' tcp 0 0 172.104.112.130:80 0.0.0.0:* LISTEN 931/nginx: master p tcp 0 0 0.0.0.0:8083 0.0.0.0:* LISTEN 941/nginx: master p tcp 0 0 127.0.0.1:8084 0.0.0.0:* LISTEN 931/nginx: master p tcp 0 0 127.0.0.1:54922 127.0.0.1:8084 TIME_WAIT -'
cn flag
@Bruce Looks like you installed and started [Nginx](https://en.wikipedia.org/wiki/Nginx). That's another web server software, similar to Apache's HTTP server. You can only run one server at the same port at the same time. So you need to choose which to use, and stop / uninstall the other. Alternatively you can chose another port (TCP 81 instead of TCP 80, for example), but it depends on what you're exactly doing whether this is feasable.
Bruce avatar
nf flag
Thank you Henning. Actually I just want to update the php to 7.4. But the process needs me to restart apache to use the installed php7.4. I also tried to uninstall the apache but it doesn't work.
cn flag
@Bruce Well, there are two kinds of server software now, and only one can use port TCP 80 at the same time ;) Maybe you want to do some reading on the basic principles, or maybe somebody from a [LUG](https://en.wikipedia.org/wiki/Linux_user_group) near you can help you more "hands-on" than we can do here.
Bruce avatar
nf flag
Thank you Henning. I would like to read more on this. At least I am sure now I am running nginx on my server.
Bruce avatar
nf flag
'/etc/nginx/sites-available/default' If Nginx is run, should I get the FastCGI block for the above command? But the system can not find the file.....so I am very confused that both apache and Nginx cannot be found.....
cn flag
@Bruce If you installed the `nginx` package from the default repositories, the file `/etc/nginx/sites-available/default` should exist. But there are other packages from 3rd party sources like PPAs, not to speak of installation methods other than `deb` packages. I don't know what _exactly_ you did to end with NGINX ;) Maybe it helps to check what packages with "nginx" in their name are installed: `apt list --installed *nginx*`. But we're leaving the scope of your original question in a hurry here ;) I'd really recommend to do some extensive reading and/or get some support where you are.
Bruce avatar
nf flag
Listing... Done nginx/stable,now 1.23.1-1~bionic amd64 [installed,upgradable to: 1.23.3-1~bionic] vesta-nginx/stable,now 1.0.0-1 amd64 [installed] May be it is due to the vesta cp installed. Thank you very much
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.