1

I created a phpinfo.php page in my Magento2 project but when I try to access it via URL it shows a 404 page.

It's set up here in the magento root:

|-Magento2
|-----<other folders etc.>
|-----phpinfo.php

url I try to go to: site.local/phpinfo.php - returns 404

I tried running all the commands but still 404s.. is it something with routing that's preventing me from just accessing a file normally?

Edit: my phpinfo code:

<?php
    phpinfo();
  • Can you please add your code here – Rutvee Sojitra Dec 17 '18 at 9:16
  • are you using nginx? – satya prakash patel Dec 17 '18 at 9:19
  • @trey Bake !!, Give a try to adding index.php after your domain. Like http://site.local/index.php/phpinfo.php If still not work than rename .htaccess than check. – Vivek Dec 17 '18 at 9:19
  • site.local this runs your magento2 website correctly? What is the document root of your magento2 instance? – Sukumar Gorai Dec 17 '18 at 9:23
  • @satyaprakashpatel nah, apache :) – treyBake Dec 17 '18 at 9:25
1

I tried it on my instance and it works nicely. I added the file in the root folder and when calling it in the browser it shows my PHP info.
Make sure you disable the cache (especially full page cache). Maybe the page is cached from a previous request.
Also if you are on nginx where .htaccess has no effect, maybe you have a rule configured that redirects everything to index.php and Magento does not find the info page.

  • yeah was my bad - forgot I set docroot to pub/ so obviously pub/phpinfo.php 404s – treyBake Dec 17 '18 at 9:29

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.