我在 PHP 5.3.3 上使用 Laravel 4 会遇到什么问题?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17062182/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What problems could I meet with Laravel 4 on PHP 5.3.3?
提问by Alexandre Butynski
I know that the Laravel 4 requirements are PHP >= 5.3.7 but my client must recent application server only has PHP 5.3.3. Yes, three years old version...
我知道 Laravel 4 的要求是 PHP >= 5.3.7 但我的客户端必须最近的应用程序服务器只有 PHP 5.3.3。是的,三年前的版本...
I need more arguments to explain the situation and find a solution with him (no move, upgrade or cloud hosting).
我需要更多的论据来解释情况并与他一起找到解决方案(不动、升级或云托管)。
The questions are the following :
问题如下:
- Can I make L4 run with PHP 5.3.3 ?
- If not, why ?
- If so, how and with what limitations ?
- 我可以让 L4 与 PHP 5.3.3 一起运行吗?
- 如果不是,为什么?
- 如果是这样,如何以及有哪些限制?
[EDIT] What I know about my client configuration is : Red Hat Enterprise Linux 6.3 on VMWare virtual machine with Apache 2.2 and PHP 5.3.3.
[编辑] 我对我的客户端配置的了解是:带有 Apache 2.2 和 PHP 5.3.3 的 VMWare 虚拟机上的 Red Hat Enterprise Linux 6.3。
回答by Attila Szeremi
Laravel 4 requires PHP 5.3.7
due to using the bcrypt algorithm when hashing passwords, which received a huge bugfix at that version.
Laravel 4 需要 PHP,5.3.7
因为在哈希密码时使用 bcrypt 算法,该版本在该版本中收到了一个巨大的错误修复。
Have a look at this article for bringing the requirement of PHP for Laravel 4 down to 5.3.2
: http://laravel.io/topic/39/laravel-4-easily-extended
看看这篇文章,将 Laravel 4 的 PHP 要求降低到5.3.2
:http: //laravel.io/topic/39/laravel-4-easily-extended
EDIT: here is an archived version of the linked article, as the original appears to be down: https://web.archive.org/web/20130805153640/http://laravel.io/topic/39/laravel-4-easily-extended
编辑:这是链接文章的存档版本,因为原始版本似乎已关闭:https: //web.archive.org/web/20130805153640/http: //laravel.io/topic/39/laravel-4-易于扩展
NOTE: some PHP versions of 5.3.3
on certain distros do have the bcrypt algorithm fix backported into them, such as RedHat. You can read on how you can test if the distro you are using is one of them here; if it is, your distro supports the fix, and in turn supports Laravel 4 out of the box.
注意:5.3.3
某些发行版上的某些PHP 版本确实将 bcrypt 算法修复程序反向移植到其中,例如 RedHat。您可以在此处阅读如何测试您使用的发行版是否是其中之一;如果是,你的发行版支持修复,反过来支持 Laravel 4 开箱即用。
回答by Ryan
I had an experience with a remote webhost that offers several versions of php, and somehow, was set to an older default version of php.
我曾使用过提供多个 php 版本的远程虚拟主机,但不知何故,它被设置为较旧的默认 php 版本。
For example, I could not figure out why my migrations would not run - artisan commands failed for no apparent reason, when a nearly identical local setup worked. Come to find out that my root folder was set to 5.2 something. A quick chat session with the webhost guys, and they showed me how to fix. Presto- migrations work.
例如,我无法弄清楚为什么我的迁移无法运行 - 当几乎相同的本地设置工作时,artisan 命令无缘无故失败。快来发现我的根文件夹被设置为 5.2 的东西。与虚拟主机人员的快速聊天会话,他们向我展示了如何修复。Presto-迁移工作。
Much of the rest of my application worked, but the artisan functionality is a no-can-do-without for me. Hope that helps.
我的应用程序的大部分其余部分都有效,但工匠功能对我来说是不可缺少的。希望有帮助。
Also, the built-in php development web serveris handy - starts with 5.4.
此外,内置的 php 开发 Web 服务器很方便 - 从 5.4 开始。
EDIT: Here is a little more ammo for you: another specific issue I encountered:
编辑:这是给你的更多弹药:我遇到的另一个具体问题:
root@Grisbuntu:/home/ryan/MyApp6# php /usr/bin/composer.phar update
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- zizaco/entrust dev-master requires php >=5.4.0 -> no matching package found.
...
root@Grisbuntu:/home/ryan/MyApp6# php -v
PHP 5.3.10-1ubuntu3.6 with Suhosin-Patch (cli) (built: Mar 11 2013 14:31:48)
So there you have it: Entrust is one specific example of a package you cannot use without 5.4....
这样你就知道了:Entrust 是一个没有 5.4 就不能使用的包的具体例子......
sudo add-apt-repository ppa:ondrej/php5
sudo apt-get update
sudo apt-get install php5
php -v
...PHP 5.4.15-1~precise+1 (cli) (built: May 13 2013 16:00:00)
composer update
...
I hope that helps someone!
我希望能帮助别人!
UPDATE: July 2013, per php.net: Please Note: This will be the last regular release of the PHP 5.3 series. All users of PHP are encouraged to upgrade to PHP 5.4 or PHP 5.5. The PHP 5.3 series will receive only security fixes for the next year.
更新:2013 年 7 月,根据php.net:请注意:这将是 PHP 5.3 系列的最后一个常规版本。鼓励所有 PHP 用户升级到 PHP 5.4 或 PHP 5.5。PHP 5.3 系列将只收到明年的安全修复程序。