Reputation: 277
I try to run php7.4 in ubuntu 21.10 but I get this error.
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
Missing libphp7.4.so
I installed libphp7.4-embed
but the problem persists. The files are installed in /usr/lib/ not in /usr/lib/apache2/modules/. Symbolic link did not help (undefined symbol: php7_module
).
How to make php7.4 run in ubuntu 21.10?
I try some commands
$ sudo a2enconf php7.4-fpm
Conf php7.4-fpm already enabled
$ sudo a2enmod php7.4-fpm
ERROR: Module php7.4-fpm does not exist!
Upvotes: 7
Views: 10624
Reputation: 1803
I needed to stay on php7.4, so moving to 8.1 was not an option. Line 3 of php7.4.load
made referance to libphp7.4.so
LoadModule php7_module /usr/lib/apache2/modules/libphp7.4.so
When googling, I learned that I was missing an php module. Apache2 would start after installing this.
sudo apt install -y libapache2-mod-php7.4
Upvotes: 2
Reputation: 564
Both OP and @Andrew have pieced together a good solution, but since I just had to do this, let me put it all together, with a few extra clarification steps.
First: What version of PHP do you have now / will you use?
php -v
Returns PHP 8.1.2
so 8.1
in my case.
Next, disable the existing apache2 module that was giving you trouble:
sudo a2dismod php7.4
Finally, enable the one you found above:
sudo a2enmod php8.1
Restart apache2 and you're all set.
sudo systemctl restart apache2
Upvotes: 14
Reputation: 277
after much try and error:
rm /etc/apache2/mods-enabled/php7.4.load
Now it works.
(there is only one php* in mods-enabled: php7.4.conf
. I don't know if it matters.)
Upvotes: 2