Symfony 链接到错误的 PHP 版本 [英] Symfony is linked to the wrong PHP version
问题描述
我正在尝试将我的项目移动到使用 Apache 的 linux redhat 服务器,但我面临的问题是该服务器安装了 2 个不同的 PHP 版本.
I'm trying to move my Project to a linux redhat server that uses Apache but the problem I'm facing there is that this Server has 2 different PHP versions installed.
Symfony (2.5.12) 似乎默认在 /usr/bin/php
寻找 php 可执行文件,但安装了 5.2 版本,其他项目需要.
Symfony (2.5.12) seems to look for the php executable at /usr/bin/php
by default but there is a 5.2 version installed, which is needed for other projects.
在 /opt/rh/php55/root/usr/bin/php
是我想用于 symfony 的已安装 PHP 5.5 版本.
At /opt/rh/php55/root/usr/bin/php
is an installed 5.5 version of PHP that I want to use for symfony.
那么如何配置 Symfony 以使用安装在自定义路径的 php 版本?
So how can I configure Symfony to use the php version that is installed at the custom path?
推荐答案
如果是您的 Web 应用程序使用了错误版本的 PHP,这是 Apache 配置问题.如果是命令行,这实际上很容易修复,您只需要确保 /opt/rh/php55/root/usr/bin/
在您的 $PATH
在 /usr/bin
之前.
If it's your web application that's using the wrong version of PHP, this is an Apache configuration issue. If it's the command line, this is actually a pretty easy thing to fix, you just need to make sure that /opt/rh/php55/root/usr/bin/
is in your $PATH
before /usr/bin
.
你可以在你的 ~/.bashrc
或 ~/.bash_profile
中这样做:
You can do this in your ~/.bashrc
or ~/.bash_profile
with this:
export PATH=/opt/rh/php55/root/usr/bin:$PATH
把它放在最后,退出并重新登录.您也可以直接在命令行中弹出它,但它仅适用于当前会话,因此 ~/.bashrc
或 ~/.bash_profile
选项是更好.
Just put that at the end, log out and in again. You can also just pop that in your command line directly, but it'll only apply for the current session, so the ~/.bashrc
or ~/.bash_profile
options are better.
这篇关于Symfony 链接到错误的 PHP 版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!