DEV Community

5 1

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

Collapse
 
leslieeeee profile image
Leslie โ€ข

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!

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?

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

AWS GenAI LIVE!

GenAI LIVE! is a dynamic live-streamed show exploring how AWS and our partners are helping organizations unlock real value with generative AI.

Tune in to the full event

DEV is partnering to bring live events to the community. Join us or dismiss this billboard if you're not interested. โค๏ธ