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

Linda Hamilton
Release: 2024-10-19 12:58:29
Original
482 people have browsed it

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!

source:php
Statement of this Website
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
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!