RE: [PHP] Re: Weird behavior of exec()

2010-07-16 Thread Bob McConnell
From: Leonardo

 Em 15/07/2010 18:54, Shawn McKenzie escreveu:
 On 07/15/2010 04:40 PM, Leonardo wrote:

 Bad habit. I know.

 Did it fix it?

 
 Not really. The server allows short open tags. So, nothing changed.

You are running b.php as an external command, so it is running as a CLI,
not in the httpd server. You need to check to see how your PHP command
line is configured, it may need the full tag no matter how the server is
set up.

Bob McConnell

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: Weird behavior of exec()

2010-07-16 Thread Leonardo

Em 16/07/2010 09:23, Bob McConnell escreveu:

You are running b.php as an external command, so it is running as a CLI,
not in the httpd server. You need to check to see how your PHP command
line is configured, it may need the full tag no matter how the server is
set up.

Bob McConnell


While reading your post, I thought about using the script and binary 
full paths. Now it works.


exec('/usr/local/bin/php /full_path_here/a.php  output.txt ');

The weirdest to me thing is this:

passthru('pwd'); // shows the current directory correctly
passthru('php -h'); // shows php help output correctly

So, if my current working directory is correct, and if php -h is 
enough for help message, why should I use full path in my sample?


Anyway, it's working and my application is back on-line.

Thank you.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Weird behavior of exec()

2010-07-15 Thread Shawn McKenzie
On 07/15/2010 10:51 AM, Leonardo wrote:
 Hi everybody. I need to use exec() to run a background php script, but
 it's not working properly. Take a look at this sample:
 
 a.php
?
 
echo ' File A (1) ';
 
exec('php b.php  output.txt ');
 
echo ' File A (2) ';
 
?
 
 b.php
?
 
echo 'File B';
 
?
 

Try not use the short open tag.  Use ?php

-- 
Thanks!
-Shawn
http://www.spidean.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Weird behavior of exec()

2010-07-15 Thread Leonardo

Em 15/07/2010 18:19, Shawn McKenzie escreveu:

On 07/15/2010 10:51 AM, Leonardo wrote:

Hi everybody. I need to use exec() to run a background php script, but
it's not working properly. Take a look at this sample:

a.php
?

echo ' File A (1) ';

exec('php b.php  output.txt');

echo ' File A (2) ';

?

b.php
?

echo 'File B';

?



Try not use the short open tag.  Use?php



Bad habit. I know.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Weird behavior of exec()

2010-07-15 Thread Shawn McKenzie
On 07/15/2010 04:40 PM, Leonardo wrote:
 
 Bad habit. I know.

Did it fix it?

-- 
Thanks!
-Shawn
http://www.spidean.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Weird behavior of exec()

2010-07-15 Thread Leonardo

Em 15/07/2010 18:54, Shawn McKenzie escreveu:

On 07/15/2010 04:40 PM, Leonardo wrote:


Bad habit. I know.


Did it fix it?



Not really. The server allows short open tags. So, nothing changed.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php