I am trying to install Magento 2 after finish install all and composer, went to the browser http://url/setup and get error:

 * Copyright © 2016 Magento. All rights reserved.
 * See COPYING.txt for license details.

if (PHP_SAPI == 'cli') {
    echo "You cannot run this from the command line." . PHP_EOL .
        "Run \"php bin/magento\" instead." . PHP_EOL;
try {
    require __DIR__ . '/../app/bootstrap.php';
} catch (\Exception $e) {
    echo <<<HTML
<div style="font:12px/1.35em arial, helvetica, sans-serif;">
    <div style="margin:0 0 25px 0; border-bottom:1px solid #ccc;">
        <h3 style="margin:0;font-size:1.7em;font-weight:normal;text-transform:none;text-align:left;color:#2f2f2f;">
        Autoload error</h3>

// For Setup Wizard we are using our customized error handler
$handler = new \Magento\Framework\App\ErrorHandler();
set_error_handler([$handler, 'handler']);

\Zend\Mvc\Application::init(require __DIR__ . '/config/application.config.php')->run();

try to run from the command line getting:

PHP Fatal error: Allowed memory size of 2097152 bytes exhausted (tried to allocate 8192 bytes) in /var/www/magento2/setup/config/states.extensionManager.config.php on line 66

I have change the memory_limit = 2048MB in the php.ini under
/etc/php/7.0/apache2 and made restart to the apache
enter image description here

  • Tried to increase memory_limit in php.ini? Commented Dec 13, 2016 at 14:56

2 Answers 2


Sounds like you haven't given PHP enough memory. You can check your current memory limit via <?php phpinfo(); ?>

To increase the limit, edit your php.ini file and find the memory_limit, or create it if you can't find it. Set it to something like memory_limit = 2048M, depending on your available resources. Magento is very memory intensive.

  • thank you for your reply, I increased the limit in the php.ini but is same. I should edit the php.ini under the /etc/php/7.0/apache2/ right? Commented Dec 14, 2016 at 1:29
  • Could you show result from phpinfo() ?
    – LinoPham
    Commented Dec 14, 2016 at 1:47

The problem was that I changed the memory_limit to 2048MB and not to 2048M

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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