Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to display phpinfo() within Laravel for debugging PHP?

Tags:

php

laravel

What is the easiest way to display PHP configuration using

phpinfo();

in a Laravel application, to debug local PHP configuration in a development environment?

Background:

I need to find out on my Mac, where brew placed the php.ini file which is read.

like image 642
frankfurt-laravel Avatar asked Mar 20 '26 02:03

frankfurt-laravel


2 Answers

For Laravel ..routes\web.php

add:

    Route::get('phpmyinfo', function () {
    phpinfo(); 
})->name('phpmyinfo');

Then in your URL type yourdomain.com/phpmyinfo

like image 150
Brennan James Avatar answered Mar 22 '26 11:03

Brennan James


Go to Laravel folder

/public

open

index.php

Look for the comment block

|---------------------
| Run The Application
|---------------------

Under that block just place

phpinfo();

Then start Laravel application with

php artisan serve

And open the application in browser. Don't forget to remove the line.

Please note:

This is only for local debugging purposes, as you reveal confidential information about PHP config.

like image 35
frankfurt-laravel Avatar answered Mar 22 '26 10:03

frankfurt-laravel