I'm trying to connect a preload that was added in php7.4, but I'm facing this problem:
Step 11/11 : RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/bin --filename=composer --quiet && rm -rf /root/.composer/cache
---> Running in 0ce2e24e155c
PHP Warning: PHP Startup: Failed to open stream: No such file or directory in Unknown on line 0
PHP Fatal error: Failed opening required '/app/tools/preload.php' (include_path='.:/usr/local/lib/php') in Unknown on line 0
Warning: PHP Startup: Failed to open stream: No such file or directory in Unknown on line 0
Fatal error: Failed opening required '/app/tools/preload.php' (include_path='.:/usr/local/lib/php') in Unknown on line 0
curl: (23) Failed writing body (0 != 16366)
ERROR: Service 'project-php-cli' failed to build: The command '/bin/sh -c curl -sS https://getcomposer.org/installer | php -- --install-dir=/bin --filename=composer --quiet && rm -rf /root/.composer/cache' returned a non-zero code: 1
For some reason the script does not see the file in the path I specified.
opcache.preload=/app/tools/preload.php
opcache.preload_user=www-data
Perhaps I did not understand the fact that my folder is not in the image yet, therefore the script file is not visible
If so then how do i add my files to the preload
I solve the issue by not writing the opcache.preload stuff into the php.ini directly, but to use a command in the Dockerfile to patch the php.ini after the container installed php and additional extensions correctly:
RUN echo "opcache.preload=/var/www/preload.php" >> /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini