Failed to start the Apache HTTP Server - Ubuntu 18.04 - php

I am completely new to Ubuntu and everything and am just trying to set up MyBB on my VPS with OVH. When I restart my Apache server using sudo systemctl -l status apache2, I get an error that says:
Nov 02 09:48:19 vps607432 systemd[1]: Starting The Apache HTTP Server...
Nov 02 09:48:19 vps607432 apachectl[18213]: (98)Address already in use: AH00072: make_sock: could not bind to address [::]:80
Nov 02 09:48:19 vps607432 apachectl[18213]: (98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
Nov 02 09:48:19 vps607432 apachectl[18213]: no listening sockets available, shutting down
Nov 02 09:48:19 vps607432 apachectl[18213]: AH00015: Unable to open logs
Nov 02 09:48:19 vps607432 apachectl[18213]: Action 'start' failed.
Nov 02 09:48:19 vps607432 apachectl[18213]: The Apache error log may have more information.
Nov 02 09:48:19 vps607432 systemd[1]: apache2.service: Control process exited, code=exited status=1
Nov 02 09:48:19 vps607432 systemd[1]: apache2.service: Failed with result 'exit-code'.
Nov 02 09:48:19 vps607432 systemd[1]: Failed to start The Apache HTTP Server.
I understand what the issue is here as it plainly says inside of the error what is wrong. It's just that I am unsure on how I would go about solving this issue that I am experiencing.
Thanks for taking the time to read this question, I hope that I am able to find a solution as fast as possible.

Related

Unable to start Apache2: Job for apache2.service failed because the control process exited with error code

See "systemctl status apache2.service" and "journalctl -xe" for details.
root#ip-172-31-43-5:/home/ubuntu/asterisk-18.13.0/freepbx# systemctl status apache2.service
● apache2.service - The Apache HTTP Server
Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Wed 2022-07-27 08:30:40 UTC; 8s ago
Docs: https://httpd.apache.org/docs/2.4/
Process: 11172 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILURE)
Jul 27 08:30:40 ip-172-31-43-5 systemd[1]: Starting The Apache HTTP Server...
Jul 27 08:30:40 ip-172-31-43-5 apachectl[11175]: (98)Address already in use: AH00072: make_sock: could not bind to address [::]:80
Jul 27 08:30:40 ip-172-31-43-5 apachectl[11175]: (98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
Jul 27 08:30:40 ip-172-31-43-5 apachectl[11175]: no listening sockets available, shutting down
Jul 27 08:30:40 ip-172-31-43-5 apachectl[11175]: AH00015: Unable to open logs
Jul 27 08:30:40 ip-172-31-43-5 apachectl[11172]: Action 'start' failed.
Jul 27 08:30:40 ip-172-31-43-5 apachectl[11172]: The Apache error log may have more information.
Jul 27 08:30:40 ip-172-31-43-5 systemd[1]: apache2.service: Control process exited, code=exited, status=1/FAILURE
Jul 27 08:30:40 ip-172-31-43-5 systemd[1]: apache2.service: Failed with result 'exit-code'.
Jul 27 08:30:40 ip-172-31-43-5 systemd[1]: Failed to start The Apache HTTP Server.
uninstall apache and reinstall again
sudo apt-get install apache2
install Apache2
sudo a2enmod proxy proxy_ajp proxy_balancer proxy_connect proxy_ftp proxy_http

mysql does not start on ubuntu 18.4

My website is running on docker container, which is working fine. I am trying to connect my online website's database with admin panel on local host. So I was trying to enable remote access to mysql database server. For that I added some changes in /etc/mysql/my.cnf file and on restarting mysql service I've got this error.
I think I have error in starting MYSQL COMMUNITY SERVER.
Job for mysql.service failed because the control process exited with error code.
See "systemctl status mysql.service" and "journalctl -xe" for details.
and after running systemctl status mysql.service, I get this result
mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Wed 2019-10-02 13:43:29 UTC; 40min ago
Process: 26628 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=1/FAILURE)
Oct 02 13:43:29 ip-172-31-31-42 systemd[1]: mysql.service: Control process exited, code=exited status=1
Oct 02 13:43:29 ip-172-31-31-42 systemd[1]: mysql.service: Failed with result 'exit-code'.
Oct 02 13:43:29 ip-172-31-31-42 systemd[1]: Failed to start MySQL Community Server.
Oct 02 13:43:29 ip-172-31-31-42 systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
Oct 02 13:43:29 ip-172-31-31-42 systemd[1]: mysql.service: Scheduled restart job, restart counter is at 5.
Oct 02 13:43:29 ip-172-31-31-42 systemd[1]: Stopped MySQL Community Server.
Oct 02 13:43:29 ip-172-31-31-42 systemd[1]: mysql.service: Start request repeated too quickly.
Oct 02 13:43:29 ip-172-31-31-42 systemd[1]: mysql.service: Failed with result 'exit-code'.
Oct 02 13:43:29 ip-172-31-31-42 systemd[1]: Failed to start MySQL Community Server.
-- Subject: Unit mysql.service has finished shutting down
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit mysql.service has finished shutting down.
Oct 02 14:24:59 ip-172-31-31-42 systemd[1]: mysql.service: Start request repeate
Oct 02 14:24:59 ip-172-31-31-42 systemd[1]: mysql.service: Failed with result 'e
Oct 02 14:24:59 ip-172-31-31-42 systemd[1]: Failed to start MySQL Community Serv
-- Subject: Unit mysql.service has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit mysql.service has failed.
--
-- The result is RESULT.
what could be the possible solution?
I have already tried the all other alternative commands to start mysql server but nothing works out.
This is error message I'm getting in my console.
Job for mysql.service failed because the control process exited with error code.
See "systemctl status mysql.service" and "journalctl -xe" for details.

PHP causes server shutdown

I have a centos server with 4Gb RAM.
I'm doing a PHP console batch process that may take some hours... however it doesn't finish as the server shutdown after 1 or 2 hours from lauching the process...
Here are the logs:
Dec 28 04:39:01 www systemd[1]: Starting Clean php session files...
Dec 28 04:39:02 www systemd[1]: Started Clean php session files.
Dec 28 04:40:04 www systemd[1]: Stopped target Mail Transport Agent.
Dec 28 04:40:04 www systemd[1]: Stopped target Timers.
Dec 28 04:40:04 www systemd[1]: Stopping User Manager for UID 0...
Dec 28 04:40:04 www systemd[1]: Stopping Session 12236053 of user root.
Dec 28 04:40:04 www systemd[1]: Stopped Daily apt upgrade and clean activities.
Dec 28 04:40:04 www systemd[24724]: Stopped target Default.
Dec 28 04:40:04 www systemd[24724]: Stopped target Basic System.
Dec 28 04:40:04 www systemd[24724]: Stopped target Sockets.
Dec 28 04:40:04 www systemd[24724]: Reached target Shutdown.
Dec 28 04:40:04 www systemd[24724]: Starting Exit the Session...
Dec 28 04:40:04 www systemd[24724]: Stopped target Timers.
Dec 28 04:40:04 www systemd[24724]: Stopped target Paths.
Dec 28 04:40:04 www systemd[1]: Stopping Session 12226070 of user root.
Dec 28 04:40:04 www systemd[1]: Stopped Run certbot twice daily.
Dec 28 04:40:04 www systemd[1]: Stopped Daily apt download activities.
Dec 28 04:40:04 www systemd[1]: Stopped Clean PHP session files every 30 mins.
Dec 28 04:40:04 www systemd[1]: Stopped Daily Cleanup of Temporary Directories.
Dec 28 04:40:04 www systemd[1]: Stopped target Graphical Interface.
Dec 28 04:40:04 www systemd[1]: Stopped target Multi-User System.
Dec 28 04:40:04 www systemd[1]: Stopped target Login Prompts.
Dec 28 04:40:04 www systemd[1]: Stopping Console Getty...
Dec 28 04:40:04 www systemd[1]: Stopping Getty on tty2...
Dec 28 04:40:04 www systemd[1]: Stopping LSB: modules.dep creation....
Dec 28 04:40:04 www systemd[1]: Stopping Unattended Upgrades Shutdown...
Dec 28 04:40:04 www systemd[1]: Stopping OpenBSD Secure Shell server...
Dec 28 04:40:04 www systemd[1]: Stopping LSB: Record successful boot for GRUB...
Dec 28 04:40:04 www systemd[1]: Stopping LSB: Start/stop sysstat's sadc...
Dec 28 04:40:04 www systemd[1]: Stopping A high performance web server and a reverse proxy server...
Dec 28 04:40:04 www systemd[1]: Stopping Regular background program processing daemon...
Dec 28 04:40:04 www systemd[1]: Stopping Runit service supervision...
Dec 28 04:40:04 www systemd[1]: Stopping D-Bus System Message Bus...
Dec 28 04:40:04 www systemd[24724]: Received SIGRTMIN+24 from PID 11820 (kill).
Dec 28 04:40:04 www systemd[1]: Stopping LSB: Starts or stops the xinetd daemon....
Dec 28 04:40:04 www systemd[1]: Stopping LSB: Postfix Mail Transport Agent...
Dec 28 04:40:04 www systemd[1]: Stopping The PHP 7.0 FastCGI Process Manager...
Dec 28 04:40:04 www systemd[1]: Stopping vsftpd FTP server...
Dec 28 04:40:04 www rsyslogd: [origin software="rsyslogd" swVersion="8.20.0" x-pid="370" x-info="http://www.rsyslog.com"] exiting on signal 15.
It starts the clean php session files then suddently stops all services and shuts down!
My code seems ok....do I need to force cleaning the variables on code?
What is the problem?
Thanks

unable to start service of apache2

These are the follow output streamed when I give command to restart the service of apache
apache2.service - LSB: Apache2 web server
Loaded: loaded (/etc/init.d/apache2; bad; vendor preset: enabled)
Drop-In: /lib/systemd/system/apache2.service.d
└─apache2-systemd.conf
Active: failed (Result: exit-code) since Tue 2017-08-08 11:14:56 IST; 42s ago
Docs: man:systemd-sysv-generator(8)
Process: 3568 ExecStart=/etc/init.d/apache2 start (code=exited, status=2)
Aug 08 11:14:56 Lab2-73 systemd[1]: Starting LSB: Apache2 web server...
Aug 08 11:14:56 Lab2-73 apache2[3568]: /etc/init.d/apache2: 46: .: Can't open /e
Aug 08 11:14:56 Lab2-73 apache2[3568]: /etc/init.d/apache2: 57: .: Can't open /e
Aug 08 11:14:56 Lab2-73 apache2[3568]: ERROR: APACHE_PID_FILE needs to be define
Aug 08 11:14:56 Lab2-73 systemd[1]: apache2.service: Control process exited, cod
Aug 08 11:14:56 Lab2-73 systemd[1]: Failed to start LSB: Apache2 web server.
Aug 08 11:14:56 Lab2-73 systemd[1]: apache2.service: Unit entered failed state.
Aug 08 11:14:56 Lab2-73 systemd[1]: apache2.service: Failed with result 'exit-co
Please check your configuration under /etc/init.d/apache2/. There migth be a misconfiguration. Have a look at this little guide.
If you cant find the mistake you can also reinstall apache2 but keep in mind that you will loose your whole configuration (depending on the actual configuration)

httpd wont start with added lines for php

I updated today my httpd and php version on Arch for ARM.
The current version is now:
apachectl -V
Server version: Apache/2.4.7 (Unix)
Server built: Mar 6 2014 17:04:51
Server's Module Magic Number: 20120211:27
Server loaded: APR 1.5.0, APR-UTIL 1.5.3
Compiled using: APR 1.5.0, APR-UTIL 1.5.3
Architecture: 32-bit
Server MPM: event
threaded: yes (fixed thread count)
forked: yes (variable process count)
I need also php for owncloud and other php project, because of that I added the lines:
LoadModule php5_module modules/libphp5.so
AddHandler php5-script php
Include conf/extra/php5_module.conf
to the file /etc/httpd/conf/httpd.conf.
Before the update this config works fine, after the update apache will not start anymore and it shows always the error:
Mar 07 03:43:59 alarm apachectl[1006]: [Fri Mar 07 03:43:59.408232 2014] [:crit] [pid 1008:tid 3070083072] Apache is running a threaded MPM, but your PHP Module is not compiled to be threadsafe. You need to recompile PHP.
Mar 07 03:43:59 alarm apachectl[1006]: AH00013: Pre-configuration failed
Mar 07 03:43:59 alarm systemd[1]: httpd.service: control process exited, code=exited status=1
Mar 07 03:43:59 alarm systemd[1]: Failed to start Apache Web Server.
Mar 07 03:43:59 alarm systemd[1]: Unit httpd.service entered failed state.
Removing and reinstalling php does not help. How can I fix this problem?
To switch to prefork MPM on Apache/2.4.7 (like the previous version of Apache), do this in /etc/httpd/conf/httpd.conf:
LoadModule mpm_prefork_module modules/mod_mpm_prefork.so
#LoadModule mpm_event_module modules/mod_mpm_event.so
and after httpd restart, on my raspberry pi.
apache upgrade in 2.4.7 :
Mar 07 19:33:56 rasperus systemd[1]: Starting Apache Web Server...
Mar 07 19:33:56 rasperus apachectl[23469]: [Fri Mar 07 19:33:56.909344 2014] [:crit] [pid 23471:tid 3069247488] Apache is running a threaded MPM, but your PHP Module is not compiled to be threadsafe. You need to recompile PHP.
Mar 07 19:33:56 rasperus apachectl[23469]: AH00013: Pre-configuration failed
Mar 07 19:33:56 rasperus systemd[1]: httpd.service: control process exited, code=exited status=1
Mar 07 19:33:56 rasperus systemd[1]: Failed to start Apache Web Server.
Mar 07 19:33:56 rasperus systemd[1]: Unit httpd.service entered failed state.
and after modification in httpd.conf :
Mar 07 19:45:11 rasperus systemd[1]: Starting Apache Web Server...
Mar 07 19:45:12 rasperus systemd[1]: PID file /run/httpd/httpd.pid not readable (yet?) after start.
Mar 07 19:45:12 rasperus systemd[1]: Started Apache Web Server.
Switch to the prefork MPM (in 2.4, you can change with just LoadModule) or switch your mod_php out to using one of the many fastcgi based options (php-fpm + mod_proxy_fcgi is a popular one).

Categories