简体   繁体   English

如何在没有自制程序和ZSH的情况下更新PHP版本?

[英]How do I update PHP version without homebrew and using ZSH?

I'm trying to update my PHP version from 7.1.x to 7.3.x. 我正在尝试将我的PHP版本从7.1.x更新到7.3.x。 Unfortunately once I run the curl command to update the version, my php -v still outputs the following. 不幸的是,一旦我运行curl命令更新版本,我的php -v仍然输出以下内容。

PHP 7.1.23 (cli) (built: Nov 27 2018 16:59:25) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies

Heres the curl command I'm using and the reference of where I found this command. 这是我正在使用的curl命令以及找到该命令的位置的参考。

curl -s https://php-osx.liip.ch/install.sh | bash -s 7.3

Reference: https://php-osx.liip.ch/ 参考: https : //php-osx.liip.ch/

I've then added the following to my .zshrc file to update my path with ZSH's built in mapping. 然后我添加以下到我的.zshrc文件来更新我的ZSH内置的映射路径。 See: https://stackoverflow.com/a/18077919/6572260 参见: https : //stackoverflow.com/a/18077919/6572260

# Append to Path PHP
path+=("/usr/local/php5/bin")

# Export the PATH
export PATH=$PATH

This doesn't work either and I have no idea what I'm doing wrong. 这也不起作用,我也不知道我在做什么错。

So after much headbanging on my desk, I finally figured it out. 所以经过多次撞头我的办公桌上,我终于想通了。 5 hours later. 5小时后。

I tried many methods, but what I didn't realize was that the path for php has to be prepended and not appended to the path . 我尝试了许多方法,但我没有意识到的是, php路径必须是前置的,而不是附加到该路径

So the line in my .zshrc file needed to be changed from 因此,我的.zshrc文件中的行需要从

# Append to Path PHP
path+=("/usr/local/php5/bin")
# Prepend the Path for PHP
path=("/usr/local/php5/bin" $path)

Also a little note, that the $path can also be $PATH inside the mapping. 还要注意一点, $path在映射内部也可以是$PATH

Hopefully this helps someone along the way who was running into the same issue and hitting a giant wall. 希望这可以帮助遇到同一问题并碰壁的人。

Reference first Question in FAQ section here: https://php-osx.liip.ch/#faq 在此处的FAQ部分中参考第一个问题: https : //php-osx.liip.ch/#faq

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM