I'm trying to add Gitlab CI for a Symfony project and on the build stage I have a script that installs required extensions and libraries, at the end, runs composer install:
apt-get update -yqq \
&& apt-get install git libcurl4-gnutls-dev libicu-dev libmcrypt-dev libvpx-dev libjpeg-dev libpng-dev libxpm-dev zlib1g-dev libfreetype6-dev libxml2-dev libexpat1-dev libbz2-dev libgmp3-dev libldap2-dev unixodbc-dev libpq-dev libsqlite3-dev libaspell-dev libsnmp-dev libpcre3-dev libtidy-dev libzip-dev libonig-dev -yqq \
&& docker-php-ext-install mbstring pdo_mysql curl json intl gd xml zip bz2 opcache \
&& pecl install xdebug \
&& docker-php-ext-enable xdebug \
&& curl -sS https://getcomposer.org/installer | php \
&& php composer.phar install
the problem is I get memory_limit error as follows:
!!
!! In 40bd61cdac921aa5789618d083759e080acd3c990e06953a3380ae5c5e1156fa.php line 3768:
!!
!! Error: Allowed memory size of 134217728 bytes exhausted (tried to allocate
!! 122880 bytes)
!!
!!
!! cache:clear [--no-warmup] [--no-optional-warmers]
!!
!!
I tried to increase PHP memory_limit from 128M to 256M but it doesn't work. I tried the following:
php -d memory_limit=256M composer.phar install
I also tried php -r "ini_set('memory_limit', '256M');" but it does not have any effects too.
any suggestions on how to solve this problem?
SOLVED FOR ME USING THIS COMMAND:
sed -i -e "s/\(memory_limit = \).*/\1256M/" $PHP_INI_DIR/php.ini
it directly edits memory_limit value from php.ini file.