Skip to content

magentoCLI actions not working if docroot points to /pub #339

Closed
@powli

Description

@powli

Preconditions

  1. Any compatible Magento version
  2. Any compatible MFTF version
  3. Have your web server (Apache or Nginx) point to the <MAGE_ROOT_DIR>/pub as recommended in the DevDocs

Steps to reproduce

Run any test or suite with a magentoCLI step in test <before> or <after>

Expected result

CLI command is executed properly

Actual result

The command is not executed via shell exec but via POST call to the Magento instance

The problem is that the file to be executed, /dev/tests/acceptance/utils/command.php, is outside the /pub directory and as such usually not accessible.

To overcome this, there is additional configuration necessary on web server level (example ngnix configuration):

location /dev/tests/acceptance/ {
    root $MAGE_ROOT;

    location ~ ^/dev/tests/acceptance/utils/[^.]+\.php {
        fastcgi_pass   $FASTCGI_BACKEND;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include        fastcgi_params;

        allow <local_ip>;
        deny all;
    }
}

This should probably either be documented in the setup guides for MFTF or rectified to use the shell command instead.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions