makapaka's avatar

how to quickly enable phpinfo in lumen api

Sorry for the noob question but I just added a php file to the /public folder of my Lumen api with phpinfo() in it and getting NotFoundHttpException when I try access at either /site/public/info.php or site/info.php.

Is there a quick and easy way to enable it without having to add routes or other code ?

Also just technically, is it valid to use phpinfo in this way as its an API ? The API doesn't use the shell php version does it ?

thanks

0 likes
6 replies
click's avatar
click
Best Answer
Level 35

if it is in your public directory and you have your vhosts set up correctly it should just be: yourdomain.com/info.php

And just as an alternative option. You could also run php artisan tinker in your console and than just enter phpinfo(). It won't be as nice as the html version, but it will give you the same information.

note as cronix mentioned below. Above alternative is not showing the exact same information as phpinfo() on your webserver. So be aware of that.

makapaka's avatar

I do believe its set up correctly, I access the api in postman like /site/api/...

I did try /site/info.php in browser and above is the error I get

makapaka's avatar

ah crap, misspelling, please delete ! :)

1 like
click's avatar

I did not say site/info.php go to: yourdomain.com/info.php. If you put info.php in your public directory and the link I gave you is not working than your setup is not correct.

Your vhost document root or nginx server configuration should point to your public directory.

Cronix's avatar

@m-rk That's not quite true. It will give you phpinfo for the cli version, not the webserver. So the values will all be for the cli.

And just as an alternative option. You could also run php artisan tinker in your console and than just enter phpinfo(). It won't be as nice as the html version, but it will give you the same information.

For mine, it showed Loaded Configuration File => /etc/php/7.1/cli/php.ini

It also shows the same data that you would get from executing php -i from the cli (not tinker, the actual cli)

1 like
click's avatar

@Cronix yes you are totally right didn't think about that. I've updated my comment

Please or to participate in this conversation.