galiganu
asked on
How to find out PHP, APACHE and MySQL install directories from a php script?
Hi,
I need to find out PHP, APACHE and MySQL install directories from a php script.
It is possible?
Thanks,
gali
I need to find out PHP, APACHE and MySQL install directories from a php script.
It is possible?
Thanks,
gali
But you have to write a program that can do it before...
ASKER
Just to be more clear: I need to find the paths to php, apachectl and mysqld executables.
Also to MySQL databases location.
Thanks again,
gali
Also to MySQL databases location.
Thanks again,
gali
ASKER
thanks ixti
what this program should do? search the entire hard drive for this executables?
what this program should do? search the entire hard drive for this executables?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Conceited,
for example, I don't have any of paths related with Apache, MySQL and PHP in my PATH enviroment... But this is one the easier solution anyway (if this enviroment is set).
for example, I don't have any of paths related with Apache, MySQL and PHP in my PATH enviroment... But this is one the easier solution anyway (if this enviroment is set).
Well the $_SERVER var should be accessible it also contain path related info
imo ixti's solution is time exausting
imo ixti's solution is time exausting
I totally agree that my solution is VERY exhausting. But:
1. Superglobal arrays may not have necessary data for Conceited solution.
2. There's no way to do this in simple and beautiful way. There's no built-in functions. So even if everythin what you need will be present in enviroment or server variables, even in this case you'll got to open, then parse config files...
3. You can do <?php $a = array(); exec('dir c:\php.exe /S', $a); ?> and then extract data you need. Or simply make a lightweight program that do the same as "dir C:\php.exe /S" but returns only paths, so you can grab them to array and do what you want.
1. Superglobal arrays may not have necessary data for Conceited solution.
2. There's no way to do this in simple and beautiful way. There's no built-in functions. So even if everythin what you need will be present in enviroment or server variables, even in this case you'll got to open, then parse config files...
3. You can do <?php $a = array(); exec('dir c:\php.exe /S', $a); ?> and then extract data you need. Or simply make a lightweight program that do the same as "dir C:\php.exe /S" but returns only paths, so you can grab them to array and do what you want.
You can use exec() or passthru() to call your external program which can do it.