Jump to content

Help with popen on linux?


Asus

Recommended Posts

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
Share on other sites

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...

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.