我必须在安装了LAMP(PHP v5.3.10)的Ubuntu 10.04服务器的旧服务器上安装Laravel 4。我运行了以下命令;
sudo add-apt-repository ppa:ondrej/php5-oldstable
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install php5
sudo apt-get install php5-mysql php5-json php5-mcrypt
curl -sS https://getcomposer.org/installer | php5
sudo mv composer.phar /usr/local/bin/composer
composer create-project laravel/laravel --prefer-dist
Problem 1
laravel/framework v4.2.9 requires php >=5.4.0 -> no matching package found.
我已经卸载并使用不同的命令重新安装它无济于事。我知道laravel安装程序是指LAMP安装的PHP软件包。通过检查版本;
php -v
PHP 5.3.10 with Suhosin-Patch (cli) (built: Mar 5 2012 18:10:34)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies
php5 -v
PHP 5.4.33-1+deb.sury.org~lucid+1 (cli) (built: Sep 19 2014 11:21:37)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies
如何让它引用较新的php5包而不是旧的?我无法更新LAMP包,因为正在运行许多其他项目。
答案 0 :(得分:1)
这不是Laravel的问题。 Laravel由PHP执行,由Apache执行。
因此,您需要配置Apache虚拟主机为您执行此操作,这里是一个虚拟主机文件,可以在同一主机中运行两个不同版本的PHP,这可能会帮助您开始解决问题:
<VirtualHost *:80>
ServerName testphp540.com
DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride All
AddHandler php-cgi .php
Action php-cgi /cgi-bin-php/php-cgi-5.4.0
</Directory>
ErrorLog /var/log/apache2/error.log
LogLevel warn
CustomLog /var/log/apache2/access.log combined
</VirtualHost>
<VirtualHost *:80>
ServerName testphp550.com
DocumentRoot /var/www
<Directory />virtual host
Options FollowSymLinks
AllowOverride All
AddHandler php-cgi .php
Action php-cgi /cgi-bin-php/php-cgi-5.5.0
</Directory>
ErrorLog /var/log/apache2/error.log
LogLevel warn
CustomLog /var/log/apache2/access.log combined
</VirtualHost>
<VirtualHost *:80>
ServerName testphp556.com
DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride All
AddHandler php-cgi .php
Action php-cgi /cgi-bin-php/php-cgi-5.5.6
</Directory>
ErrorLog /var/log/apache2/error.log
LogLevel warn
CustomLog /var/log/apache2/access.log combined
</VirtualHost>
以下是{HOW TO:http://www.distrogeeks.com/install-multiple-php-versions-in-ubuntu-lamp-server/。并在谷歌上搜索&#34;运行多个php版本&#34;也应该帮助你。