1

I am trying a new local development method on windows using magento 2 on vagrant on windows and it's up and running. Now I'm trying to add xdebug with PHPstorm but it's unable to "see" an uploaded phpinfo.php file because all PHP files are disabled.

The phpinfo.php file is in pub but when viewing http://myinstall.local/phpinfo.php I get the 404 page and I'm trying to figure out where it is and to remove this as it's only a test system on my localhost.

I have commented out the last lines of magento\nginx.conf: (note magento is the root folder on the installation)

# Banned locations (only reached if the earlier PHP entry point regexes don't match)
#location ~* (\.php$|\.txt$|\.phtml$|\.htaccess$|\.git) {
#    deny all;
#}

I've tried adding phpinfo to (what I believe are exclusions to being sent to eh main script) exclusion:

# PHP entry point for main application
location ~ ^/(index|get|static|errors/report|errors/404|errors/503|health_check|phpinfo)\.php$ {

And of course I have restarted nginx:

vagrant@magento2-test:~/magento$ sudo /etc/init.d/nginx restart

[ ok ] Restarting nginx (via systemctl): nginx.service.

I have confirmed that the error page is severed from /errors/404.php and so I've commented out the lines of magento\.htaccess and magento\pub\.htaccess that would use this:

# For 404s and 403s that aren't handled by the application, show plain 404 response
#ErrorDocument 404 /errors/404.php
#ErrorDocument 403 /errors/404.php

In general the .htaccess seems to be allowing any specific file...

############################################
## Never rewrite for existing files, directories and links

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l

...so I am now quite confused - can anyone please advise what else I could try to allow a random PHP file, or even a specific one like phpinfo.php, to serve from the pub folder please?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.