I’ve just bough VPS account for testing and development.
Is there a function of PHP to parse Apache config file, PHP config, FTP Server config, zone files, etc? Also a way to insert data into config file.
I want to create a simple Control Panel to add ftp accounts and web account (with domain). If you have done it before – how did you do it?
It would be quite challenging to learn
Thanks.
No, PHP has no functions to parse the config files of those programs – you’ll have to write a custom parser for most of those formats. However, for php.ini you might be able to use PHP’s ini functions.
Most webhosting control panels either create the whole config file based on their database – i.e. they never read it but only (over)write it or they require you to include (apache and bind support that for example, for PHP you can use php_admin_value in the apache virtualhosts) their generated file – which is also never read by the tool.
If you really want to create a tool that actually modifies existing files, don’t forget that you cannot simply skip comments as nobody would want an application to rewrite his config file stripping all comments.