Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What problems could I meet with Laravel 4 on PHP 5.3.3?

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

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 ?

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

like image 396
Alexandre Butynski Avatar asked Jun 12 '13 09:06

Alexandre Butynski


2 Answers

Laravel 4 requires PHP 5.3.7 due to using the bcrypt algorithm when hashing passwords, which received a huge bugfix at that version.

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

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

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.

like image 198
Attila Szeremi Avatar answered Sep 28 '22 15:09

Attila Szeremi


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.

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.

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 server is handy - starts with 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....

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.

like image 34
Ryan Avatar answered Sep 28 '22 17:09

Ryan