Has anyone managed to get Magento running under PHP 5.4 with the built-in web server? I have used the HTRouter PHAR to mimic .htaccess rules - but so far I'm coming up empty, all roads at the moment lead to

Fatal error: Call to a member function getFrontNameByRoute() on a non-object

  • Magento 1.7.x runs fine on PHP 5.4.14 on Apache as php_mod or PHP_FPM, tried them both in VM running Ubuntu. As for built in Server, that one I haven't tried yet. – Petar Dzhambazov May 9 '13 at 21:02

So I had a quick look into this and got it running pretty easily.

Instructions for Debian

cat >> /etc/apt/sources.lst <<EOF
deb http://packages.dotdeb.org squeeze-php54 all
deb-src http://packages.dotdeb.org squeeze-php54 all

wget -qO - http://www.dotdeb.org/dotdeb.gpg | apt-key add -
apt-get update
apt-get install php5-cli php5-mysqlnd php5-mcrypt php5-common php-pear php5-dev php5-mysql php5-curl php5-mcrypt php5-gd php5-cli php5-xsl php5-imagick

Then I made a simple router (instead of using HTRouter), that mimicked the rules in a stock Magento .htaccess


  if (preg_match('#^/api/rest#', $_SERVER["REQUEST_URI"])) {
      $_SERVER["REQUEST_URI"] = 'api.php?type=rest';
  } elseif (preg_match('#^/(media|skin|js)#', $_SERVER["REQUEST_URI"])) {
      return false;
  } elseif (file_exists(".".$_SERVER["REQUEST_URI"]))  {
      return false;
  } else {
      include_once 'index.php';


Then started the PHP server and pointed it at router.php (the file from above).

php -S router.php

Works just fine :)

Content sourced from sonassi.com

| improve this answer | |

Per the System Requirements, Magento requires "PHP 5.2.13 - 5.3.15".

Magento 2 (last I heard) does not even yet fully support PHP 5.4 yet…although there is a lot of debate on whether or not to require it, and final support for it is obvious.

Some of these compatibility issues stem from, I believe, issues in PHP 5.4's SimpleXML implementation: https://bugs.php.net/bug.php?id=62639

My conclusion: Stick with the latest PHP 5.3.x build and don't risk using non-officially supported

| improve this answer | |
  • Thanks for the fast reply - I understand what is and isn't supported; I'm trying to see if anyone else is experimenting with it at the moment. Too much time with Laravel makes me want this feature I suppose... – philwinkle May 9 '13 at 20:56
  • ok, so more of a what's been messed with to see if we can get it to work… gotcha. – davidalger May 9 '13 at 20:58
  • 1
    It's more for experimentation than anything else - I have about 15 CentOS VMs and a bunch of boilerplate VMs set up with Magento at all different levels of CE/EE - I'm just curious how this would work to bootstrap new features/development. If you've ever seen it in action, Laravel has a pretty impressive demo where they git clone and php -S and BOOM - demo app. Of course, Magento is a platform on top of Zend and I'm sure I could replicate that kind of demo with ZF. – philwinkle May 9 '13 at 21:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.