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. Link to comment https://forums.phpfreaks.com/topic/180745-help-with-popen-on-linux/ 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??! Link to comment https://forums.phpfreaks.com/topic/180745-help-with-popen-on-linux/#findComment-953600 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... Link to comment https://forums.phpfreaks.com/topic/180745-help-with-popen-on-linux/#findComment-953602 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. Link to comment https://forums.phpfreaks.com/topic/180745-help-with-popen-on-linux/#findComment-953604 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('[email protected]', 'popen', 'works'); echo "hello"; ?> But script only outputs: X-Powered-By: PHP/5.2.9 And doesnt sends email... Link to comment https://forums.phpfreaks.com/topic/180745-help-with-popen-on-linux/#findComment-953639 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.