views:

498

answers:

2

I am thinking along the lines of replicating a web hosts PHP setup environment for offline local development. The idea is to parse the output of phpinfo() and write any setup values it contains into a local php.ini. I would imagine everything ism included in phpinfo and that certain things would only be specific to the environment it is running on (paths).

A: 

It's quite likely to just be a stock install. Even then, I'd still want to make the local development environment subtly different to the live php.ini, to ensure that it showed all errors that were being produced (as opposed to hiding, or just logging them on the live site).

Alister Bulman
+3  A: 

You will probably get more usable results from ini_get_all()

http://us.php.net/manual/en/function.ini-get-all.php

You could then traverse the associated array to reconstruct an ini file without the hassle of interpreting the output of phpinfo()