Summary of Installing httpd and php in Mac OS 12

  • stackoverflow.com
  • Article
  • Summarized Content

    Overview

    The user updated their MacOS to Monterey (12.0.1) and encountered an issue where PHP stopped working, as macOS 12 seems to have removed native PHP support. They tried to configure everything using Homebrew but faced an error while trying to start the Apache httpd server.

    Error Message

    user@Laptop folder % /opt/homebrew/opt/httpd/bin/httpd -D FOREGROUND                  
    dyld[15738]: Symbol not found: _apr_bucket_file_set_buf_size
      Referenced from: /opt/homebrew/Cellar/httpd/2.4.51/bin/httpd
      Expected in: /usr/lib/libaprutil-1.0.dylib
    zsh: abort      /opt/homebrew/opt/httpd/bin/httpd -D FOREGROUND
    

    The user was getting the above error related to the missing _apr_bucket_file_set_buf_size symbol and questioned if they were missing any package for it.

    Solution

    One of the accepted answers suggested that switching from the native Apache to Homebrew's Apache package was not easy, and the user faced a similar error after installing, configuring, and starting Homebrew's Apache. The solution that worked was to run brew reinstall apr-util to resolve the apr_bucket error.

    • After reinstalling apr-util, the user removed Homebrew's Apache using brew remove httpd.
    • Then, they reinstalled it with brew install httpd.
    • Next, they updated the httpd.conf configuration file.
    • Finally, they started the Apache server using brew services start httpd, which resolved the issue.

    Key Takeaways

    • macOS 12 Monterey has removed native PHP support, causing errors when trying to use PHP.
    • Homebrew's Apache (httpd) package can be used as an alternative, but the installation and configuration process may involve resolving dependency errors like the apr_bucket_file_set_buf_size error.
    • Reinstalling packages like apr-util, updating configuration files, and properly starting the Apache server can help resolve such errors.
    • Switching from the native Apache to Homebrew's Apache package in macOS 12 Monterey requires careful troubleshooting and configuration steps.

    Ask anything...

    Sign Up Free to ask questions about anything you want to learn.