Docker: How to change php-fpm conf

Docker: How to change php-fpm conf

September 25, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Docker: How to change php-fpm conf

Solving Php-fpm Configuration Errors in Docker

You’re on the right track using Docker for your Magento setup, but it seems you’ve hit some roadblocks with php-fpm configuration errors during the installation process. Let’s dive into how to troubleshoot and resolve these issues within a Docker environment.

Understanding the Error

The error message indicates that access to the /setup/index.php/navigation script has been denied due to the security.limit_extensions directive in your PHP-FPM configuration (www.conf). By default, this directive restricts execution of certain file extensions for security reasons. In your case, it’s likely preventing Magento’s setup scripts from executing.

Accessing and Modify the Configuration

Docker images are read-only by design to enhance security. However, you can make changes to files within a running container using Docker volumes or bind mounts. Here’s how to access and modify the www.conf file in your case:

  1. First, find the name of the container running php-fpm:

    docker ps
    
  2. Create a named volume to persist the configuration changes:

    docker volume create my_phpfpm_volume
    
  3. Stop and remove the existing container.

  4. Run a new container with your preferred image (e.g., markoshust/magento-php:7.1), mount the persistent volume to /etc/php/conf.d, and open some ports for access:

    docker run -d --name my_phpfpm_container -v my_phpfpm_volume:/etc/php/conf.d -p 9000:9000 markoshust/magento-php:7.1
    

Editing the Configuration File

Now, mount the volume to your local file system and edit the www.conf file:

docker run -it --rm --volumes-from my_phpfpm_container alpine ash -c 'apk add --no-cache nano && nano /etc/php/conf.d/www.conf'

Remove or comment out the line containing security.limit_extensions = .php .phtml to allow execution of PHP scripts.

Verifying the Changes

Start your container again and verify that the changes are applied:

docker start my_phpfpm_container

You can then access your Magento setup page at http://magento2.test/setup/. The error should now be resolved, allowing you to proceed with the installation.

Remember, changing configuration files directly in a Docker container isn’t usually recommended for production environments. Consider creating your own Dockerfile or using environment variables to manage such configurations for better control and reproducibility.

For more advanced PHP-FPM configuration strategies in Laravel projects, I recommend checking out our comprehensive guide on Optimizing PHP-FPM for Laravel Applications at Laravel Company.

Security API Extensions Configuration

Our network