LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 09-26-2022, 02:39 AM   #1
Pedroski
Senior Member
 
Registered: Jan 2002
Location: Nanjing, China
Distribution: Ubuntu 20.04
Posts: 2,116

Rep: Reputation: 73
apache2 won't start


I just did a dist upgrade, from Ubuntu 20.04 to 22.04.

Now apache2 won't start, I can't test my own, home-made webpages on my localhost! Could you please give me some tips?

line 146 of apache2.conf is: IncludeOptional mods-enabled/*.load

php is installed and the newest version.

Quote:
pedro@pedro-512ssd:~$ php --version
PHP 8.1.2 (cli) (built: Aug 8 2022 07:28:23) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.2, Copyright (c) Zend Technologies
with Zend OPcache v8.1.2, Copyright (c), by Zend Technologies
pedro@pedro-512ssd:~$

In /usr/lib/apache2/modules/ I have libphp8.1.so


Quote:
apache2.service - The Apache HTTP Server
Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Mon 2022-09-26 15:16:32 CST; 1min 56s ago
Docs: https://httpd.apache.org/docs/2.4/
Process: 948 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILURE)
CPU: 45ms

9月 26 15:16:32 pedro-512ssd systemd[1]: Starting The Apache HTTP Server...
9月 26 15:16:32 pedro-512ssd apachectl[984]: apache2: Syntax error on line 146 of /etc/apache2/apache2.conf: Syntax error on line 3 of /etc/apache2/mods-enabled/php7.4.load: Cannot load /usr/lib/apache2/modules/libphp7.4.so into server: /usr/lib/apache2/modules/libphp7.4.so: cannot open shared object file: No such file or directory

Cannot load /usr/lib/apa>che2/modules/libphp7.4.so into server: /usr/lib/apache2/modules/libphp7.4.so: cannot open shared object file: No such file or directory
9月 26 15:16:32 pedro-512ssd apachectl[948]: Action 'start' failed.
9月 26 15:16:32 pedro-512ssd apachectl[948]: The Apache error log may have more information.
9月 26 15:16:32 pedro-512ssd systemd[1]: apache2.service: Control process exited, code=exited, status=1/FAILURE
9月 26 15:16:32 pedro-512ssd systemd[1]: apache2.service: Failed with result 'exit-code'.
9月 26 15:16:32 pedro-512ssd systemd[1]: Failed to start The Apache HTTP Server.

Last edited by Pedroski; 09-26-2022 at 02:56 AM.
 
Old 09-26-2022, 03:07 AM   #2
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,345
Blog Entries: 3

Rep: Reputation: 3756Reputation: 3756Reputation: 3756Reputation: 3756Reputation: 3756Reputation: 3756Reputation: 3756Reputation: 3756Reputation: 3756Reputation: 3756Reputation: 3756
There are some syntax errors in the configuration file. The line numbers in question are given in the error message which you have posted. If the files themselves have not changed, then check to ensure that the relevant Apache2 modules are installed and active.

The utilities apache2ctl configtest and a2enmod or a2query can possibly help.
 
Old 09-26-2022, 03:51 AM   #3
Pedroski
Senior Member
 
Registered: Jan 2002
Location: Nanjing, China
Distribution: Ubuntu 20.04
Posts: 2,116

Original Poster
Rep: Reputation: 73
Thanks!

I ran a2enmod,

Quote:
pedro@pedro-512ssd:~$ sudo a2enmod
[sudo] password for pedro:
Your choices are: access_compat actions alias allowmethods asis auth_basic auth_digest auth_form authn_anon authn_core authn_dbd authn_dbm authn_file authn_socache authnz_fcgi authnz_ldap authz_core authz_dbd authz_dbm authz_groupfile authz_host authz_owner authz_user autoindex brotli buffer cache cache_disk cache_socache cern_meta cgi cgid charset_lite data dav dav_fs dav_lock dbd deflate dialup dir dump_io echo env expires ext_filter file_cache filter headers heartbeat heartmonitor http2 ident imagemap include info lbmethod_bybusyness lbmethod_byrequests lbmethod_bytraffic lbmethod_heartbeat ldap log_debug log_forensic lua macro md mime mime_magic mpm_event mpm_prefork mpm_worker negotiation php7.2 php7.4 php8.1 proxy proxy_ajp proxy_balancer proxy_connect proxy_express proxy_fcgi proxy_fdpass proxy_ftp proxy_hcheck proxy_html proxy_http proxy_http2 proxy_scgi proxy_uwsgi proxy_wstunnel ratelimit reflector remoteip reqtimeout request rewrite sed session session_cookie session_crypto session_dbd setenvif slotmem_plain slotmem_shm socache_dbm socache_memcache socache_redis socache_shmcb speling ssl status substitute suexec unique_id userdir usertrack vhost_alias xml2enc
Which module(s) do you want to enable (wildcards ok)?
php8.1
Considering dependency mpm_prefork for php8.1:
Considering conflict mpm_event for mpm_prefork:
Considering conflict mpm_worker for mpm_prefork:
Module mpm_prefork already enabled
Considering conflict php5 for php8.1:
Module php8.1 already enabled
pedro@pedro-512ssd:~$

I have a sym link: /etc/apache2/mods-enabled/php8.1.load which links to ../mods-available/php8.1.load and there is:

Quote:
# Conflicts: php5
# Depends: mpm_prefork
LoadModule php_module /usr/lib/apache2/modules/libphp8.1.so
Now I need to tell apache2 to load php8.1.so not php7.4.so, I think!??!

Where do I tell apache2 that?? Which conf?
 
Old 09-26-2022, 04:16 AM   #4
Pedroski
Senior Member
 
Registered: Jan 2002
Location: Nanjing, China
Distribution: Ubuntu 20.04
Posts: 2,116

Original Poster
Rep: Reputation: 73
Got it working!

I went to /etc/apache2/mods-enabled and renamed the php7.4.load

Quote:
sudo mv php7.4.load php7.4.load.old
Then I had to set the permissions again: (is there some way to avoid having to do this??)

Quote:
sudo chown -R pedro /var/www/
sudo chgrp -R www-data /var/www/
sudo chmod -R 770 /var/www/
sudo chmod g+s /var/www/
Now my localhost opens, but I need a new version of phpMyAdmin, it won't work with php 8.1
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] BASH: service apache2 start => check apache2 response dragonetti Linux - Newbie 2 10-29-2011 11:01 AM
apache2 won't start, no error given mikecrowe Linux - Networking 12 09-19-2010 04:46 PM
Apache2.2 won't start dana340 Linux - Newbie 14 01-20-2006 07:56 PM
apache2 won't start atheist Linux - Software 1 10-23-2004 04:14 PM
Apache2 won't start sasklinuxuser Linux - General 4 09-22-2004 02:33 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 08:28 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration