Magento2: set deployment mode to production fails, command returned non-zero exit code

Created on 12 Jan 2016  路  13Comments  路  Source: magento/magento2

Hi,
I have a running thread @ stackexchange but would like to draw more attention to this problem as I also have it with a clean manual installation using the latest github code.

foo@en07-phx [~/public_html/m2test/bin]# php magento deploy:mode:show
Current application mode: default.
foo@en07-phx [~/public_html/m2test/bin]# php magento deploy:mode:set production
Enabled maintenance mode
Static content deployment start
Command returned non-zero exit code:
`php -f /home/foo/public_html/m2test/bin/magento setup:static-content:deploy en_US 2>&1`

If I run the failed command separately, I don't get any errors.

Most helpful comment

@MichielTG the same issue on php 7

All 13 comments

@jvanderbiest we are having trouble reproducing this issue. What OS, PHP version and web server are you using? Also, have you tried executing from magento root instead of bin. eg php bin/magento deploy:mode:set production or bin/magento deploy:mode:set production

@mazhalai thanks for looking into it. Is there any logging that I can turn on using that command? I'm currently using stablehost and here is the server information.

Apache Version: 2.4.17
PHP Version: 5.3.29 (says the server, but I've configured it in cpanel it to use 5.5)
MySQL Version: 10.0.20-MariaDB-cll-lve
Architecture: x86_64
Operating System: linux

PHP 5.3 v 5.5 could be the issue. You could have both versions on your server( one could be configured for cli and another for apache) For Magento 2, 5.5 is the minimum supported. Please verify on the command line php -v and create a test.php file with

<?php phpinfo();

and open this page in the browser. Look for PHP version on this page. Make sure both are PHP 5.5 or higher.

I've even upgraded to 5.6.16 now and still the same error. I generated a phpinfo file as you asked. You can view the static version here: http://vanderbiest.be/temp/phpinfo.html

I've the same issue, PHP 5.6.9, CentOS. What do you need to know? When I executing command from error, it ends with success.

@maqlec can you clarify this : When I executing command from error, it ends with success.

I receive the same error message as at your first post

[root@server magento]# sudo -u apache bin/magento deploy:mode:set production
Enabled maintenance mode
Static content deployment start
Command returned non-zero exit code:
`php -f /app/magento/bin/magento setup:static-content:deploy pl_PL 2>&1`

After this I run the command that supposedly returns an error and succeeds with output:

[root@server magento]# php -f /app/magento/bin/magento setup:static-content:deploy pl_PL 2>&1
Requested languages: pl_PL
=== frontend -> Magento/blank -> pl_PL ===
......................................................
Successful: 1965 files; errors: 0
---

=== frontend -> Magento/luma -> pl_PL ===
......................................................
Successful: 2038 files; errors: 0
---

=== adminhtml -> Magento/backend -> pl_PL ===
......................................................
Successful: 1843 files; errors: 0
---

=== Minify templates ===
......................................................
Successful: 846 files modified
---

New version of deployed files: 1455822288

This looks like a problem with the output of STDERR. Does anyone know what to do with it?

I solved my problem. It was enough to increase the memory limit in php.ini to 512M. After this compilation was successful.

@maqlec thanks, that solved the problem!
@mazhalai you can close this issue. Setting the PHP Memory limit to 512M solved it!

Thanks for the update @jvanderbiest and @maqlec. Closing issue

We are having the same issue #3850. However we have increased the memory_size to 2GB so this doesn't seem to be the problem. I'm wondering if you also did other things to fix this issue?

Update:
We are failing at the compilation instead of the static content deployment.

@MichielTG the same issue on php 7

@MichielTG @yuklia please do not post on closed issues, create a new issue please.

Was this page helpful?
0 / 5 - 0 ratings