Home  >  Article  >  Backend Development  >  How to Resolve PHP Installation Issues After Using Homebrew\'s mcrypt?

How to Resolve PHP Installation Issues After Using Homebrew\'s mcrypt?

Linda Hamilton
Linda HamiltonOriginal
2024-10-19 12:58:29483browse

How to Resolve PHP Installation Issues After Using Homebrew's mcrypt?

Troubleshooting PHP Installation After Using Homebrew's mcrypt

Problem: PHP installed via Homebrew doesn't appear in phpinfo() when Apache is in use.

Check for PHP Differences:

  1. Run brew search php to verify if there are multiple PHP versions.
  2. Check the output of php -v to see which PHP version Apache is using.

Make Apache Use Homebrew PHP:

  1. Install the desired PHP version using brew install [email protected].
  2. Add the following to .zshrc (for zsh users): export PATH="/usr/local/opt/[email protected]/bin:$PATH"
  3. Reload .zshrc with source ~/.zshrc.

Enable PHP in Apache:

  1. Add the following to httpd.conf:

    • LoadModule php_module /usr/local/opt/php/lib/httpd/modules/libphp.so
      • SetHandler application/x-httpd-php
  2. Check that DirectoryIndex includes index.php.
  3. Locate the configuration files:

    • php.ini: /usr/local/etc/php/[PHP version]/
    • php-fpm.ini: /usr/local/etc/php/[PHP version]/

The above is the detailed content of How to Resolve PHP Installation Issues After Using Homebrew\'s mcrypt?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn