Hardening the generation of pathconfig.php.

Prevent PHP injection possibility, by using var_export() to generate the
pathconfig.php.
Merge pull request #6863 from tristanlins/feature/pathconfig-hardening-2