Home > Backend Development > PHP Tutorial > macos - mac uses brew to install php instead of SegmentFault of the original system

macos - mac uses brew to install php instead of SegmentFault of the original system

WBOY
Release: 2016-10-18 08:56:01
Original
1706 people have browsed it

<code>5.6.27 (brew安装的版本)
</code>
Copy after login
Copy after login

macos - mac uses brew to install php instead of SegmentFault of the original system

<code>5.6.24
</code>
Copy after login
Copy after login

macos - mac uses brew to install php instead of SegmentFault of the original system

<code>export PATH="/usr/local/bin:/usr/local/sbin:$PATH"</code>
Copy after login
Copy after login

This has been added to ~/.bashrc
So I don’t understand why

Reply content:

<code>5.6.27 (brew安装的版本)
</code>
Copy after login
Copy after login

macos - mac uses brew to install php instead of SegmentFault of the original system

<code>5.6.24
</code>
Copy after login
Copy after login

macos - mac uses brew to install php instead of SegmentFault of the original system

<code>export PATH="/usr/local/bin:/usr/local/sbin:$PATH"</code>
Copy after login
Copy after login

This has been added to ~/.bashrc
So I don’t understand why

The path of php that comes with your Mac, before the path you set, the previously matched php will be used first.

First which php, find the path that comes with php, and then rename it. For example mv xxx/php xxx/php5.6.27.

However, I am not sure whether deleting the built-in php or mv will cause problems for other applications, so it is recommended not to delete it directly, at least keep a backup.

<code>sudo ln -sf [php5.6.27目录]/bin/php /usr/bin/php
sudo ln -sf [php5.6.27目录]/bin/pecl /usr/bin/pecl
sudo ln -sf [php5.6.27目录]/bin/phpize /usr/bin/phpize
sudo ln -sf [php5.6.27目录]/bin/pear /usr/bin/pear

#重启php-fpm, 非fpm模式重启apache
#或者干脆重启mac
sudo reboot</code>
Copy after login
Related labels:
source:php.cn
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template