gabrielkolbe Posted August 11, 2008 Share Posted August 11, 2008 Hi, I have a website, which I want to install on 'clients' servers..the website run on PHP, MySQL. Firstly I want a page to check if PHP is installed, then MySQL, then smtp, gd, curl. Can I use the phpinfo(), ? I tried to use phpinfo() place it in a string and search the strings for certain values, but it does not seem to work.. does anyone have any ideas, or better any scripts I can just edit? I would be greatful. Quote Link to comment Share on other sites More sharing options...
DarkWater Posted August 11, 2008 Share Posted August 11, 2008 You can try function_exists() to test for certain functions, or you can just pass the phpinfo() data to grep or something. Quote Link to comment Share on other sites More sharing options...
gabrielkolbe Posted August 11, 2008 Author Share Posted August 11, 2008 Hi, thanks for that. I can use function_exist, but also need to verify the data in the phpinfo() page.. i don't understand 'pass the phpinfo() data to grep or something.' please explain. I probably need to get phpinfo() into a string..?? Quote Link to comment Share on other sites More sharing options...
DarkWater Posted August 11, 2008 Share Posted August 11, 2008 Yeah. <?php ob_start(); phpinfo(); $phpinfo = ob_get_clean(); From that point, you can just use a regex or something, or grep. Whatever you want. Quote Link to comment Share on other sites More sharing options...
discomatt Posted August 11, 2008 Share Posted August 11, 2008 function_exists is by far the cleanest way to do this. Quote Link to comment Share on other sites More sharing options...
DarkWater Posted August 11, 2008 Share Posted August 11, 2008 function_exists is by far the cleanest way to do this. Indeed it is. xD Quote Link to comment Share on other sites More sharing options...
gabrielkolbe Posted August 11, 2008 Author Share Posted August 11, 2008 yes, I agree. But how do you check if the php dependencies are available (like smtp, gd, curl) with function_exist() ? Quote Link to comment Share on other sites More sharing options...
DarkWater Posted August 11, 2008 Share Posted August 11, 2008 Use a function from that library? if (function_exists('curl_init')) { //curl good } if (function_exists('imagecreatetruecolor')) { //gd good } And what's a function in the SMTP library? o-O Quote Link to comment Share on other sites More sharing options...
discomatt Posted August 11, 2008 Share Posted August 11, 2008 You will also have to check if the function is disabled. function is_disabled($function) { $disabled_functions=explode(',',ini_get('disable_functions')); return in_array($function, $disabled_functions); } is_callable may do this for you, if you have a later version of PHP http://php.net/manual/en/function.is-callable.php Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.