Asus Posted November 8, 2009 Share Posted November 8, 2009 Hello phpfreaks.I have problem with using popen() on linux. On windows this code runs ok <?php popen('E:\php\php.exe E:\www\scr.php','r'); ?> But when i try on linux <?php popen('php /home/www/scr.php','r'); ?> Its simply doesnt work.Even if i try with full PHP path... So anyone knows what the problem is and maybe possible solution? Also every alternative for popen() which works on win/unix is welcome. Thanks a lot. Quote Link to comment Share on other sites More sharing options...
joel24 Posted November 8, 2009 Share Posted November 8, 2009 Note: When safe mode is enabled, you can only execute files within the safe_mode_exec_dir. For practical reasons, it is currently not allowed to have .. components in the path to the executable. http://php.net/manual/en/function.popen.php linux machine php ini set to safe mode??! Quote Link to comment Share on other sites More sharing options...
Asus Posted November 8, 2009 Author Share Posted November 8, 2009 When i run phpinfo(); it says safe mode is turned off...also it has no disabled functins... Quote Link to comment Share on other sites More sharing options...
joel24 Posted November 8, 2009 Share Posted November 8, 2009 do you get an error? or just nothing happens. try error_reporting(E_ALL); if its not on already. Quote Link to comment Share on other sites More sharing options...
Asus Posted November 8, 2009 Author Share Posted November 8, 2009 Yeah i already tried even with error handling but no success.. Here is mine full code main.php <?php error_reporting(E_ALL); $handle = popen('php /home/k/public_html/scr.php','r'); $h = fgets($handle); echo $h; ?> scr.php <?php error_reporting(E_ALL); mail('x@hotmail.com', 'popen', 'works'); echo "hello"; ?> But script only outputs: X-Powered-By: PHP/5.2.9 And doesnt sends email... 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.