cancel
Showing results for 
Search instead for 
Did you mean: 

Switching to Production Mode issue

Switching to Production Mode issue

I have been erroring out whenever I try to switch to production mode. Originally had been doing it without the -d memory_limit=-1 So today I tried to run with the -d memory_limit=-1 and it still errored out. I am unsure what to look for now to fix and get to production mode. Here is what is output in the Terminal:
 
Enabling maintenance mode
Starting compilation
Something went wrong while compiling generated code. See the error log for details. Disabling maintenance mode
Command returned non-zero exit code: `/opt/cpanel/ea-php73/root/usr/bin/php -f *Magento_Root*/bin/magento setup:di:compile`
#0 *Magento_Root*/vendor/magento/module-deploy/Model/Filesystem.php(267): Magento\Framework\App\Shell->execute('/opt/cpanel/ea-...')
#1 *Magento_Root*/vendor/magento/module-deploy/Model/Filesystem.php(172): Magento\Deploy\Model\Filesystem->compile(Object(Symfony\Component\Console\Output\ConsoleOutput))
#2 *Magento_Root*/vendor/magento/module-deploy/Model/Mode.php(139): Magento\Deploy\Model\Filesystem->regenerateStatic(Object(Symfony\Component\Console\Output\ConsoleOutput))
#3 [internal function]: Magento\Deploy\Model\Mode->Magento\Deploy\Model\{closure}()
#4 *Magento_Root*/vendor/magento/framework/App/Console/MaintenanceModeEnabler.php(85): call_user_func(Object(Closure))
#5 *Magento_Root*/vendor/magento/module-deploy/Model/Mode.php(147): Magento\Framework\App\Console\MaintenanceModeEnabler->executeInMaintenanceMode(Object(Closure), Object(Symfony\Component\Console\Output\ConsoleOutput), false)
#6 *Magento_Root*/vendor/magento/module-deploy/Console/Command/SetModeCommand.php(101): Magento\Deploy\Model\Mode->enableProductionMode()
#7 *Magento_Root*/vendor/symfony/console/Command/Command.php(255): Magento\Deploy\Console\Command\SetModeCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#8 *Magento_Root*/vendor/magento/framework/Interception/Interceptor.php(58): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#9 *Magento_Root*/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Deploy\Console\Command\SetModeCommand\Interceptor->___callParent('run', Array)
#10 *Magento_Root*/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Deploy\Console\Command\SetModeCommand\Interceptor->Magento\Framework\Interception\{closure}(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#11 *Magento_Root*/generated/code/Magento/Deploy/Console/Command/SetModeCommand/Interceptor.php(104): Magento\Deploy\Console\Command\SetModeCommand\Interceptor->___callPlugins('run', Array, Array)
#12 *Magento_Root*/vendor/symfony/console/Application.php(1000): Magento\Deploy\Console\Command\SetModeCommand\Interceptor->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#13 *Magento_Root*/vendor/symfony/console/Application.php(271): Symfony\Component\Console\Application->doRunCommand(Object(Magento\Deploy\Console\Command\SetModeCommand\Interceptor), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#14 *Magento_Root*/vendor/magento/framework/Console/Cli.php(115): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#15 *Magento_Root*/vendor/symfony/console/Application.php(147): Magento\Framework\Console\Cli->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#16 *Magento_Root*/bin/magento(23): Symfony\Component\Console\Application->run()
#17 {main}
As for the Logs, the only thing I am seeing is this from the debug.log:
[2023-03-13 15:43:15] main.ERROR: /opt/cpanel/ea-php73/root/usr/bin/php -f *Magento_Root*/bin/magento setup:di:compile 2>&1 Compilation was started. %message% 0/8 [>---------------------------] 0% < 1 sec 79.0 MiBProxies code generation... 0/8 [>---------------------------] 0% < 1 sec 79.0 MiB Proxies code generation... 1/8 [===>------------------------] 12% < 1 sec 83.0 MiB Repositories code generation... 1/8 [===>------------------------] 12% < 1 sec 83.0 MiB [] []
And nothing that seems relevant afterwards
 
If someone can at least point me in the right direction...
2 REPLIES 2

Re: Switching to Production Mode issue

EDIT: The below is actually a non-error error. Just means that there was someone on the website when it was running, so the listed not empty folders generated something. Going to leave this here though in case others run into it and aren't sure what to do. Just run the command again.

 

$ php bin/magento deploy:mode:set production -vvv
Enabling maintenance mode
Disabling maintenance mode
The directory "*Magento_Root*/generated/code/Magento" cannot be deleted Warning!rmdir(*Magento_Root*/generated/code/Magento): Directory not empty
#0 *Magento_Root*/vendor/magento/module-deploy/Model/Filesystem.php(291): Magento\Framework\Filesystem\Directory\Write->delete()
#1 *Magento_Root*/vendor/magento/module-deploy/Model/Filesystem.php(162): Magento\Deploy\Model\Filesystem->cleanupFilesystem(Array)
#2 *Magento_Root*/vendor/magento/module-deploy/Model/Mode.php(139): Magento\Deploy\Model\Filesystem->regenerateStatic(Object(Symfony\Component\Console\Output\ConsoleOutput))
#3 [internal function]: Magento\Deploy\Model\Mode->Magento\Deploy\Model\{closure}()
#4 *Magento_Root*/vendor/magento/framework/App/Console/MaintenanceModeEnabler.php(85): call_user_func(Object(Closure))
#5 *Magento_Root*/vendor/magento/module-deploy/Model/Mode.php(147): Magento\Framework\App\Console\MaintenanceModeEnabler->executeInMaintenanceMode(Object(Closure), Object(Symfony\Component\Console\Output\ConsoleOutput), false)
#6 *Magento_Root*/vendor/magento/module-deploy/Console/Command/SetModeCommand.php(101): Magento\Deploy\Model\Mode->enableProductionMode()
#7 *Magento_Root*/vendor/symfony/console/Command/Command.php(255): Magento\Deploy\Console\Command\SetModeCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#8 *Magento_Root*/vendor/magento/framework/Interception/Interceptor.php(58): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#9 *Magento_Root*/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Deploy\Console\Command\SetModeCommand\Interceptor->___callParent('run', Array)
#10 *Magento_Root*/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Deploy\Console\Command\SetModeCommand\Interceptor->Magento\Framework\Interception\{closure}(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#11 *Magento_Root*/generated/code/Magento/Deploy/Console/Command/SetModeCommand/Interceptor.php(104): Magento\Deploy\Console\Command\SetModeCommand\Interceptor->___callPlugins('run', Array, Array)
#12 *Magento_Root*/vendor/symfony/console/Application.php(1000): Magento\Deploy\Console\Command\SetModeCommand\Interceptor->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#13 *Magento_Root*/vendor/symfony/console/Application.php(271): Symfony\Component\Console\Application->doRunCommand(Object(Magento\Deploy\Console\Command\SetModeCommand\Interceptor), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#14 *Magento_Root*/vendor/magento/framework/Console/Cli.php(115): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#15 *Magento_Root*/vendor/symfony/console/Application.php(147): Magento\Framework\Console\Cli->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#16 *Magento_Root*/bin/magento(23): Symfony\Component\Console\Application->run()
#17 {main}

I now have the above output on the terminal with -vvv. Before running the above, I had gotten this in the debug log:

main.ERROR: The directory "*Magento_Root*/var/cache/" cannot be deleted Warning!rmdir(*Magento_Root*/var/cache/): Directory not empty
#0 *Magento_Root*/setup/src/Magento/Setup/Console/Command/DiCompileCommand.php(299): Magento\Framework\Filesystem\Directory\Write->delete()
#1 *Magento_Root*/setup/src/Magento/Setup/Console/Command/DiCompileCommand.php(173): Magento\Setup\Console\Command\DiCompileCommand->cleanupFilesystem(Array)
#2 *Magento_Root*/vendor/symfony/console/Command/Command.php(255): Magento\Setup\Console\Command\DiCompileCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#3 *Magento_Root*/vendor/symfony/console/Application.php(1000): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#4 *Magento_Root*/vendor/symfony/console/Application.php(271): Symfony\Component\Console\Application->doRunCommand(Object(Magento\Setup\Console\Command\DiCompileCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#5 *Magento_Root*/vendor/magento/framework/Console/Cli.php(115): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#6 *Magento_Root*/vendor/symfony/console/Application.php(147): Magento\Framework\Console\Cli->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#7*Magento_Root*/bin/magento(23): Symfony\Component\Console\Application->run()
#8 {main} [] []
[2023-04-03 17:21:01] main.ERROR: /opt/cpanel/ea-php73/root/usr/bin/php -f *Magento_Root*/bin/magento setup:di:compile 2>&1

In Write.php line 200:

  The directory "*Magento_Root*/var/cache/" cannot be deleted Warning!rmdir(*Magento_Root*/var/cache/): Directory not
   empty


setup:di:compile

 

Re: Switching to Production Mode issue

I figured out what my issue was locally on this. A certain module was stopping it. Ampersand's DisableStockReservation needing updating. I updated it locally and have been able to get into production mode. However, is it normal for a site to be completely blank after going into production mode? I haven't done this on my live site, but the local one goes blank. From what I can tell, after running the deploy:mode:set production, I have to clean/flush cache, run setup:upgrade run the static-content:deploy and then clean/flush cache again. That seems like a lot, and I would assume it would be the same for anytime I would need to update/install an extension

 

Edit: this was caused because Magento and Windows (Xampp) don't play well together. Got an installation of linux and it was fine. Now to just figure out why the live site doesn't want to go to production mode still