Upgraded your PHP from 7 to 8 on your macOS, then you might run into issues trying to start Apache when you run the command: sudo apachectl start
.
The issue is, the dynamic link library of PHP for PHP 8 has been changed and is saved in a different location on your macOS file system.
After upgrading to PHP 8, you will need to comment out the config line for PHP 7 similar to what is below in the file:
sudo nano /usr/local/etc/httpd/httpd.conf
The line:
#LoadModule php7_module /usr/libexec/apache2/libphp7.so
and then copy/paste the line below to link to the correct PHP 8 DLL:
LoadModule php_module /usr/local/lib/httpd/modules/libphp.so
Also, note that the module name is not php7_module
but php_module
.
After doing this, try to start/restart apache again. Hope this helps!
Enjoy, and welcome to PHP 8!
Top comments (5)
If you are macOS user, ServBay.dev is a good tool, especially for the beginners. It handles all PHP, MariaDB, PostgreSQL versions, plus Redis and Memcached. Run multiple PHP instances simultaneously and switch easily. This tool has made my PHP dev simpler. Worth a shot!
thanks sir, i have problem same and solve a read this article
Awesome ๐คฉ
Thanks, it looks like a nice solution but for some reason for me this works just as if php would be just disabled. Can't figure out yet.
Are you blocked anywhere for us to find a way to unblock you? Or is any part of the article unclear to you?