DEV Community


Issue starting up Apache after upgrading to PHP 8 on macOS

๐——๐—ฒ๐—ฟ๐—ถ๐—ฐ๐—ธ ๐—”๐—น๐—ฎ๐—ป๐—ด๐—ถ โšก๏ธ
ใƒป1 min read

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/
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/
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!

Discussion (2)

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.

xsavitar profile image
๐——๐—ฒ๐—ฟ๐—ถ๐—ฐ๐—ธ ๐—”๐—น๐—ฎ๐—ป๐—ด๐—ถ โšก๏ธ Author

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

Forem Open with the Forem app