cancel
Showing results for 
Search instead for 
Did you mean: 

magento setup production mode and compile

magento setup production mode and compile

I'm using server is Linux, Apache 2.4.29 ,Centos 7, PHP 7.1.12 , MySQL 5.6.38.

I'm install new magento2.2.2 but when i setup production mode and compile will be error.

This is about my php/server? or not? how can i fix it, thank you very much

 

php bin/magento deploy:mode:set productionEnabled maintenance modeStarting compilationSomething went wrong while compiling generated code. See the error log for details.
Command returned non-zero exit code:
`/opt/cpanel/ea-php71/root/usr/bin/php -f /home/xxx/public_html/test2/bin/magento setup:di:compile`

i running this the problem still

php bin/magento setup:upgrade
php bin/magento indexer:reindex
php bin/magento deploy:mode:set production -s (or --skip-compilation)
php bin/magento setup:di:compile

getting

[Exception] Warning: Narrowing occurred during type inference. Please file a bug report on bugs.php.net in /home/XXX/public_html/test2/vendor/composer/ClassL oader.php on line 444
3 REPLIES 3

Re: magento setup production mode and compile

It looks like this could be a PHP bug. In the latest changelog for 7.1.13 release of PHP there are two fixes for this error: http://php.net/ChangeLog-7.php#7.1.13

----
If you've found one of my answers useful, please give "Kudos" or "Accept as Solution" as appropriate. Thanks!

Re: magento setup production mode and compile

php bin/magento deploy:mode:set production --skip-compilation

Re: magento setup production mode and compile

Hello @rigu12,

 

This is not a solution to the bug of PHP 7.1.12, but can help you to avoid this warning while coming out a patch or a new version (I suppose it could be solved then).

The problem is with the OPCache library, that "... improves PHP performance by storing precompiled script bytecode in shared memory..." more info: http://php.net/manual/en/intro.opcache.php.

The "solution" is clear the cache when the application is loaded. This is easy if you have an "single entry point" application (when you use a framework, for example). Just put the next function at the beginin of your index.php (or equivalent) file:

opcache_reset();

I'm not sure that this could be used in production servers, because could turn the application heavy.

 

--
If my answer is useful, please Accept as Solution & give Kudos