I have installed this package success locally composer require spatie/laravel-image-optimizer
, but when I tried to install on the live server I got this errors
no@zz607:/var/www/html$ composer require spatie/laravel-image-
optimizer
Using version ^1.4 for spatie/laravel-image-optimizer
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
mmap() failed: [12] Cannot allocate memory
mmap() failed: [12] Cannot allocate memory
mmap() failed: [12] Cannot allocate memory
PHP Fatal error: Out of memory (allocated 544395264) (tried to
allocate 20480 bytes) in
/usr/share/php/Composer/Repository/ComposerRepository.php on line 321
Fatal error: Out of memory (allocated 544395264) (tried to allocate
20480 bytes) in
/usr/share/php/Composer/Repository/ComposerRepository.php on line 321
server info
Best option is to set /laravel/public as your document root. If you can't do that for whatever reason, you'll need to add a . htaccess file in the laravel directory to rewrite all your requests to the public folder - see here for more info.
You should not call composer require
or composer update
on production server - you should run it locally, verify that everything works fine, and commit generated composer.lock
with your project. Then on production server you need to run only composer install --no-dev
- it will install all non-dev dependencies defined in lock file. composer install
is much faster and uses fraction of RAM required by composer require
or composer update
, so it should work fine even on server with low memory. It also gives you more control on version of libraries installed on production server, so you can test app more reliable.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With