Usual Command Used in Invoice Ninja V5
Please take note to run all of this command, you will need your hosting provider to allowed jailed shell access, so that you can use the terminal provided by Cpanel. How to know you already have one? Login to your Cpanel, and look at “Advance Section”. If you have the “Terminal” as per screenshot below, it means your hosting has enable Jailed Shell Access for you.
Also this topics are related to deployment using Softaculous in Cpanel environment. That using EA-PHP80
So the important basic command based on official documentation here is;
- For optimize, clear cache, recreate cache for config and all
php artisan optimize
- For cronjob execution command to run artisan scheduler
cd /path-to-your-project && php artisan schedule:run >> /dev/null 2>&1
- For Queue command to improve performance.
cd /path/to/root/folder && /usr/bin/php -d register_argc_argv=On artisan queue:work --stop-when-empty
PHP Artisan Optimize
Symptom :
- Running “php artisan optimize” on the correct folder did not return any result.
- Inspection laravel log at storage/logs/laravel.log found memory exhaustion error as per follows
[03-Nov-2021 09:05:01 UTC] PHP Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 8192 bytes) in /home/public_html/sub.mydomainhere/v5/vendor/livewire/livewire/src/Commands/PublishCommand.php on line 45
Troubleshooting :
- Checking php memory limit at Cpanel > MultiPHP ini the limit has already being set to 2048M. And upon inspection of info.php, “local_value” is displayed 2048M, while master_value is displayed as 32M.
- If we refer to bytes calculator here we convert the value 33554432 bytes binary to Megabytes Binary, it shows as 32M, which means, the command load the master_value instead of local_value of the php.
Solution:
Dont use the following command ;
php artisan optimize
use these command instead
cd /path/to/root/folder && /usr/bin/php artisan optimize
This command will run optimize by calling set php “local_value”. If you do it correctly, you will get the following response ;
Configuration cache cleared!
Configuration cached successfully!
Route cache cleared!
Routes cached successfully!
Files cached successfully!