문제

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

도움이 되었습니까?

해결책

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
EOF

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

<?php

  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 172.16.0.249:80 router.php

Works just fine :)

Content sourced from sonassi.com

다른 팁

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 magento.stackexchange
scroll top