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
WBOYOriginal
2016-10-18 08:56:011717browse

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

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

<code>5.6.24
</code>

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>

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

Reply content:

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

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

<code>5.6.24
</code>

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>

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>
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