Povilas Brilius
2 min readFeb 10, 2021

Apparently, there was a problem debugging LAMP and PHP built-in servers on phpleague route package. Comparing the output — /, / on LAMP and built-in servers in addition to /api/v1/ping supposed to emmit JSON validated array, the meld --diff *.txt saving the output var_dump($_SERVER); at the pre-route stage is promising —

Root path for built in and API route for built in $_SERVER dump

You can see clearly, that path information is assigned to only built-in server variables, meaning LAMP is unusable on a traditional HTTP open source foundation (Apache) server. What you can do is add .htaccess server variable assignator in order to solve this simulation package problem.

Open Source Apache2 HTTP server

Actually, I’ll add only RewriteEngine off to .htaccess on the public assets serving folder root — ./bar/ . Because it’s missing key infrastructure requirements like URL usability in terms of target market — consumers, it may fit there.

Then, navigatin to localhost:2150/index.php/api/v1/ping will yield the expected $_SERVER variables dump. You can clearly see

'REQUEST_URI' => string '/index.php/api/v1/ping' (length=22)
...
'PATH_INFO' => string '/api/v1/ping' (length=12)

Let’s see now it in action — index.php

// var_dump($_SERVER);
Povilas Brilius

PHP Developer in e-commerce and e-loans industry fields.