DEV Community

Issue starting up Apache after upgrading to PHP 8 on macOS

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
Enter fullscreen mode Exit fullscreen mode

The line:

#LoadModule php7_module /usr/libexec/apache2/libphp7.so
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

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 (4)

Collapse
 
sigit_wasis13 profile image
Sigit wasis subekti

thanks sir, i have problem same and solve a read this article

Collapse
 
xsavitar profile image
𝗗𝗲𝗿𝗶𝗰𝗸 𝗔𝗹𝗮𝗻𝗴𝗶 🐬

Awesome 🤩

Collapse
 
khandaniel profile image
Daniel Khan

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.

Collapse
 
xsavitar profile image
𝗗𝗲𝗿𝗶𝗰𝗸 𝗔𝗹𝗮𝗻𝗴𝗶 🐬

Are you blocked anywhere for us to find a way to unblock you? Or is any part of the article unclear to you?