Re: Re[2]: [PHP] session_start() || shell access problem......

2003-09-21 Thread CF High
Finally!

Thanks Tom & Rasmus for pointing me in the right direction.

God, two days of bleary eyed searching -- enough is enough.  Thank you guys
for helping out a newbie.

--Noah


"Tom Rogers" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi,
>
> Monday, September 22, 2003, 2:13:57 AM, you wrote:
> CH> H,
>
> CH> Well, is there a way to pass params to file_to_be_executed in command
line?
>
> CH> For example:
>
> CH>  CH> $my_param = 'my_include_path';
> CH> $text = `usr/local/bin/php /path/to/my/php/page.php`;
> ?>>
>
> CH> Somehow I need $my_param to be passed to page.php (the file to be
processed
> CH> in command line).
>
> CH> Any ideas?
>
> CH> --Noah
>
>
>
> CH> "Marek Kilimajer" <[EMAIL PROTECTED]> wrote in message
> CH> news:[EMAIL PROTECTED]
> >> Sessions don't work on command line and that is how you run your script
> >> - from command line.
> >>
> >> CF High wrote:
> >> > Hey Robert.
> >> >
> >> > Indeed, hard to find the problem.
> >> >
> >> > I don't believe it's a whitespace issue, or even a "Headers sent
issue",
> >> > despite the fact that I'm receiving that error.
> >> >
> >> > Check it out:
> >> >
> >> > test.php contains just one line:  >> > /path/to/my/php/test1.php`;?>
> >> >
> >> > test1.php, the file to be executed, contains just one line:
> >> > 
> >> >
> >> > There are no line breaks, spaces, etc.
> >> >
> >> > Still get "Headers already sent".
> >> >
> >> > Pretty strange, right?
> >> >
> >> > Correct me if I'm wrong, but I think the problem may be related to
the
> CH> fact
> >> > that when files are executed from the command line, php now looks for
> >> > include_paths, session_paths, etc. relative to the server root; not
the
> CH> site
> >> > root.
> >> >
> >> > I can think of no other reason why include paths, starting sessions,
and
> CH> so
> >> > on, return errors from the command line but ork perfectly fine when
run
> CH> in a
> >> > browser.
> >> >
> >> > Feel free to clue me in -- I know didly about shell access issues.
> >> >
> >> > --Noah
> >> >
> >> >
> >> > "Robert Cummings" <[EMAIL PROTECTED]> wrote in message
> >> > news:[EMAIL PROTECTED]
> >> >
> >> >>On Sat, 2003-09-20 at 15:46, CF High wrote:
> >> >>
> >> >>>Hey all.
> >> >>>
> >> >>>I'm running a script from the command-line php interpreter as
follows:
> >> >>>(thanks to D. Souza for lead)
> >> >>>
> >> >>>$text = `usr/local/bin/php /path/to/my/php/page.php`;
> >> >>>
> >> >>>within the read file I want to enable sessions, so I session_start()
at
> >> >
> >> > the
> >> >
> >> >>>top of the page:
> >> >>>
> >> >>> >> >>>session_start();
> >> >>>?>
> >> >>> >> >>>code to execute here...
> >> >>>?>
> >> >>>
> >> >>>Regardless of how I mess around with placement of session_start(), I
> CH> get
> >> >
> >> > a
> >> >
> >> >>>"Headers already sent".
> >> >>>
> >> >>>Why? Nothing has been output to the browser within the read file!
> >> >>>Furthermore, if I create a test page with just:
> >> >>>
> >> >>>
> >> >>>
> >> >>>Still receive "Headers already sent".
> >> >>>
> >> >>>My eyes are completely fried -- anyone feel like saving my vision?
> >> >>
> >> >>This often is difficult to detect when there's is implicit output
> >> >>outside of the  >> >>script and see if there is any whitespace or newlines preceding the
tag.
> >> >>
> >> >>HTH,
> >> >>Rob.
> >> >>--
> >> >>..
> >> >>| InterJinn Application Framework - http://www.interjinn.com |
> >> >>::
> >> >>| An application and templating framework for PHP. Boasting  |
> >> >>| a powerful, scalable system for accessing system services  |
> >> >>| such as forms, properties, sessions, and caches. InterJinn |
> >> >>| also provides an extremely flexible architecture for   |
> >> >>| creating re-usable components quickly and easily.  |
> >> >>`'
> >> >
> >> >
>
>
> Try this
>
>  $args = '"hello world"';
> $text = `/usr/bin/php /usr/local/apache/htdocs/in.php $args`;
> echo $text;
> ?>
>
> in.php contains:
>
>  echo '';
> phpinfo(32);
> echo '';
> echo $_SERVER['argv'][1];
> ?>
>
> That should do what you want if I understand the problem :)
>
> --
> regards,
> Tom

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



Re[2]: [PHP] session_start() || shell access problem......

2003-09-21 Thread Tom Rogers
Hi,

Monday, September 22, 2003, 2:13:57 AM, you wrote:
CH> H,

CH> Well, is there a way to pass params to file_to_be_executed in command line?

CH> For example:

CH>  $my_param = 'my_include_path';
CH> $text = `usr/local/bin/php /path/to/my/php/page.php`;
?>>

CH> Somehow I need $my_param to be passed to page.php (the file to be processed
CH> in command line).

CH> Any ideas?

CH> --Noah



CH> "Marek Kilimajer" <[EMAIL PROTECTED]> wrote in message
CH> news:[EMAIL PROTECTED]
>> Sessions don't work on command line and that is how you run your script
>> - from command line.
>>
>> CF High wrote:
>> > Hey Robert.
>> >
>> > Indeed, hard to find the problem.
>> >
>> > I don't believe it's a whitespace issue, or even a "Headers sent issue",
>> > despite the fact that I'm receiving that error.
>> >
>> > Check it out:
>> >
>> > test.php contains just one line: > > /path/to/my/php/test1.php`;?>
>> >
>> > test1.php, the file to be executed, contains just one line:
>> > 
>> >
>> > There are no line breaks, spaces, etc.
>> >
>> > Still get "Headers already sent".
>> >
>> > Pretty strange, right?
>> >
>> > Correct me if I'm wrong, but I think the problem may be related to the
CH> fact
>> > that when files are executed from the command line, php now looks for
>> > include_paths, session_paths, etc. relative to the server root; not the
CH> site
>> > root.
>> >
>> > I can think of no other reason why include paths, starting sessions, and
CH> so
>> > on, return errors from the command line but ork perfectly fine when run
CH> in a
>> > browser.
>> >
>> > Feel free to clue me in -- I know didly about shell access issues.
>> >
>> > --Noah
>> >
>> >
>> > "Robert Cummings" <[EMAIL PROTECTED]> wrote in message
>> > news:[EMAIL PROTECTED]
>> >
>> >>On Sat, 2003-09-20 at 15:46, CF High wrote:
>> >>
>> >>>Hey all.
>> >>>
>> >>>I'm running a script from the command-line php interpreter as follows:
>> >>>(thanks to D. Souza for lead)
>> >>>
>> >>>$text = `usr/local/bin/php /path/to/my/php/page.php`;
>> >>>
>> >>>within the read file I want to enable sessions, so I session_start() at
>> >
>> > the
>> >
>> >>>top of the page:
>> >>>
>>  >>>session_start();
>> >>>?>
>>  >>>code to execute here...
>> >>>?>
>> >>>
>> >>>Regardless of how I mess around with placement of session_start(), I
CH> get
>> >
>> > a
>> >
>> >>>"Headers already sent".
>> >>>
>> >>>Why? Nothing has been output to the browser within the read file!
>> >>>Furthermore, if I create a test page with just:
>> >>>
>> >>>
>> >>>
>> >>>Still receive "Headers already sent".
>> >>>
>> >>>My eyes are completely fried -- anyone feel like saving my vision?
>> >>
>> >>This often is difficult to detect when there's is implicit output
>> >>outside of the > >>script and see if there is any whitespace or newlines preceding the tag.
>> >>
>> >>HTH,
>> >>Rob.
>> >>--
>> >>..
>> >>| InterJinn Application Framework - http://www.interjinn.com |
>> >>::
>> >>| An application and templating framework for PHP. Boasting  |
>> >>| a powerful, scalable system for accessing system services  |
>> >>| such as forms, properties, sessions, and caches. InterJinn |
>> >>| also provides an extremely flexible architecture for   |
>> >>| creating re-usable components quickly and easily.  |
>> >>`'
>> >
>> >


Try this



in.php contains:

';
phpinfo(32);
echo '';
echo $_SERVER['argv'][1];
?>

That should do what you want if I understand the problem :)

-- 
regards,
Tom

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



Re: [PHP] session_start() || shell access problem......

2003-09-21 Thread Rasmus Lerdorf
On Sun, 21 Sep 2003, CF High wrote:
> Well, is there a way to pass params to file_to_be_executed in command line?
> 
> For example:
> 
>  $my_param = 'my_include_path';
> $text = `usr/local/bin/php /path/to/my/php/page.php`;
> ?>
> 
> Somehow I need $my_param to be passed to page.php (the file to be processed
> in command line).
> 
> Any ideas?

Just put them after the filename and grab them out of your $argv array.

-Rasmus

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



Re: [PHP] session_start() || shell access problem......

2003-09-21 Thread CF High
Thank the heavens above

Actually, thank "Ben", a poster from php.net manual.

Looks like environment variables are not passed to file when it is executed
from the command line.

A workaround is:

$inc_path = $_SERVER['DOCUMENT_ROOT'] . '/';
$remaddr = getenv("DOCUMENT_ROOT");
putenv("DOCUMENT_ROOT=$inc_path");

That does the trick for what I need done now; namely, being able to include
files within my command line executed files.

Still, there must be a way to pass params to command line executed
files..

--Noah



"Cf High" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> H,
>
> Well, is there a way to pass params to file_to_be_executed in command
line?
>
> For example:
>
>  $my_param = 'my_include_path';
> $text = `usr/local/bin/php /path/to/my/php/page.php`;
> ?>
>
> Somehow I need $my_param to be passed to page.php (the file to be
processed
> in command line).
>
> Any ideas?
>
> --Noah
>
>
>
> "Marek Kilimajer" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > Sessions don't work on command line and that is how you run your script
> > - from command line.
> >
> > CF High wrote:
> > > Hey Robert.
> > >
> > > Indeed, hard to find the problem.
> > >
> > > I don't believe it's a whitespace issue, or even a "Headers sent
issue",
> > > despite the fact that I'm receiving that error.
> > >
> > > Check it out:
> > >
> > > test.php contains just one line:  > > /path/to/my/php/test1.php`;?>
> > >
> > > test1.php, the file to be executed, contains just one line:
> > > 
> > >
> > > There are no line breaks, spaces, etc.
> > >
> > > Still get "Headers already sent".
> > >
> > > Pretty strange, right?
> > >
> > > Correct me if I'm wrong, but I think the problem may be related to the
> fact
> > > that when files are executed from the command line, php now looks for
> > > include_paths, session_paths, etc. relative to the server root; not
the
> site
> > > root.
> > >
> > > I can think of no other reason why include paths, starting sessions,
and
> so
> > > on, return errors from the command line but ork perfectly fine when
run
> in a
> > > browser.
> > >
> > > Feel free to clue me in -- I know didly about shell access issues.
> > >
> > > --Noah
> > >
> > >
> > > "Robert Cummings" <[EMAIL PROTECTED]> wrote in message
> > > news:[EMAIL PROTECTED]
> > >
> > >>On Sat, 2003-09-20 at 15:46, CF High wrote:
> > >>
> > >>>Hey all.
> > >>>
> > >>>I'm running a script from the command-line php interpreter as
follows:
> > >>>(thanks to D. Souza for lead)
> > >>>
> > >>>$text = `usr/local/bin/php /path/to/my/php/page.php`;
> > >>>
> > >>>within the read file I want to enable sessions, so I session_start()
at
> > >
> > > the
> > >
> > >>>top of the page:
> > >>>
> > >>> > >>>session_start();
> > >>>?>
> > >>> > >>>code to execute here...
> > >>>?>
> > >>>
> > >>>Regardless of how I mess around with placement of session_start(), I
> get
> > >
> > > a
> > >
> > >>>"Headers already sent".
> > >>>
> > >>>Why? Nothing has been output to the browser within the read file!
> > >>>Furthermore, if I create a test page with just:
> > >>>
> > >>>
> > >>>
> > >>>Still receive "Headers already sent".
> > >>>
> > >>>My eyes are completely fried -- anyone feel like saving my vision?
> > >>
> > >>This often is difficult to detect when there's is implicit output
> > >>outside of the  > >>script and see if there is any whitespace or newlines preceding the
tag.
> > >>
> > >>HTH,
> > >>Rob.
> > >>--
> > >>..
> > >>| InterJinn Application Framework - http://www.interjinn.com |
> > >>::
> > >>| An application and templating framework for PHP. Boasting  |
> > >>| a powerful, scalable system for accessing system services  |
> > >>| such as forms, properties, sessions, and caches. InterJinn |
> > >>| also provides an extremely flexible architecture for   |
> > >>| creating re-usable components quickly and easily.  |
> > >>`'
> > >
> > >

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



Re: [PHP] session_start() || shell access problem......

2003-09-21 Thread CF High
H,

Well, is there a way to pass params to file_to_be_executed in command line?

For example:



Somehow I need $my_param to be passed to page.php (the file to be processed
in command line).

Any ideas?

--Noah



"Marek Kilimajer" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Sessions don't work on command line and that is how you run your script
> - from command line.
>
> CF High wrote:
> > Hey Robert.
> >
> > Indeed, hard to find the problem.
> >
> > I don't believe it's a whitespace issue, or even a "Headers sent issue",
> > despite the fact that I'm receiving that error.
> >
> > Check it out:
> >
> > test.php contains just one line:  > /path/to/my/php/test1.php`;?>
> >
> > test1.php, the file to be executed, contains just one line:
> > 
> >
> > There are no line breaks, spaces, etc.
> >
> > Still get "Headers already sent".
> >
> > Pretty strange, right?
> >
> > Correct me if I'm wrong, but I think the problem may be related to the
fact
> > that when files are executed from the command line, php now looks for
> > include_paths, session_paths, etc. relative to the server root; not the
site
> > root.
> >
> > I can think of no other reason why include paths, starting sessions, and
so
> > on, return errors from the command line but ork perfectly fine when run
in a
> > browser.
> >
> > Feel free to clue me in -- I know didly about shell access issues.
> >
> > --Noah
> >
> >
> > "Robert Cummings" <[EMAIL PROTECTED]> wrote in message
> > news:[EMAIL PROTECTED]
> >
> >>On Sat, 2003-09-20 at 15:46, CF High wrote:
> >>
> >>>Hey all.
> >>>
> >>>I'm running a script from the command-line php interpreter as follows:
> >>>(thanks to D. Souza for lead)
> >>>
> >>>$text = `usr/local/bin/php /path/to/my/php/page.php`;
> >>>
> >>>within the read file I want to enable sessions, so I session_start() at
> >
> > the
> >
> >>>top of the page:
> >>>
> >>> >>>session_start();
> >>>?>
> >>> >>>code to execute here...
> >>>?>
> >>>
> >>>Regardless of how I mess around with placement of session_start(), I
get
> >
> > a
> >
> >>>"Headers already sent".
> >>>
> >>>Why? Nothing has been output to the browser within the read file!
> >>>Furthermore, if I create a test page with just:
> >>>
> >>>
> >>>
> >>>Still receive "Headers already sent".
> >>>
> >>>My eyes are completely fried -- anyone feel like saving my vision?
> >>
> >>This often is difficult to detect when there's is implicit output
> >>outside of the  >>script and see if there is any whitespace or newlines preceding the tag.
> >>
> >>HTH,
> >>Rob.
> >>--
> >>..
> >>| InterJinn Application Framework - http://www.interjinn.com |
> >>::
> >>| An application and templating framework for PHP. Boasting  |
> >>| a powerful, scalable system for accessing system services  |
> >>| such as forms, properties, sessions, and caches. InterJinn |
> >>| also provides an extremely flexible architecture for   |
> >>| creating re-usable components quickly and easily.  |
> >>`'
> >
> >

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



Re: [PHP] session_start() || shell access problem......

2003-09-21 Thread Marek Kilimajer
Sessions don't work on command line and that is how you run your script 
- from command line.

CF High wrote:
Hey Robert.

Indeed, hard to find the problem.

I don't believe it's a whitespace issue, or even a "Headers sent issue",
despite the fact that I'm receiving that error.
Check it out:

test.php contains just one line: 
test1.php, the file to be executed, contains just one line:

There are no line breaks, spaces, etc.

Still get "Headers already sent".

Pretty strange, right?

Correct me if I'm wrong, but I think the problem may be related to the fact
that when files are executed from the command line, php now looks for
include_paths, session_paths, etc. relative to the server root; not the site
root.
I can think of no other reason why include paths, starting sessions, and so
on, return errors from the command line but ork perfectly fine when run in a
browser.
Feel free to clue me in -- I know didly about shell access issues.

--Noah

"Robert Cummings" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
On Sat, 2003-09-20 at 15:46, CF High wrote:

Hey all.

I'm running a script from the command-line php interpreter as follows:
(thanks to D. Souza for lead)
$text = `usr/local/bin/php /path/to/my/php/page.php`;

within the read file I want to enable sessions, so I session_start() at
the

top of the page:



Regardless of how I mess around with placement of session_start(), I get
a

"Headers already sent".

Why? Nothing has been output to the browser within the read file!
Furthermore, if I create a test page with just:


Still receive "Headers already sent".

My eyes are completely fried -- anyone feel like saving my vision?
This often is difficult to detect when there's is implicit output
outside of the 
HTH,
Rob.
--
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'


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


Re: [PHP] session_start() || shell access problem......

2003-09-20 Thread CF High
Hey Robert.

Indeed, hard to find the problem.

I don't believe it's a whitespace issue, or even a "Headers sent issue",
despite the fact that I'm receiving that error.

Check it out:

test.php contains just one line: 

test1.php, the file to be executed, contains just one line:


There are no line breaks, spaces, etc.

Still get "Headers already sent".

Pretty strange, right?

Correct me if I'm wrong, but I think the problem may be related to the fact
that when files are executed from the command line, php now looks for
include_paths, session_paths, etc. relative to the server root; not the site
root.

I can think of no other reason why include paths, starting sessions, and so
on, return errors from the command line but ork perfectly fine when run in a
browser.

Feel free to clue me in -- I know didly about shell access issues.

--Noah


"Robert Cummings" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> On Sat, 2003-09-20 at 15:46, CF High wrote:
> > Hey all.
> >
> > I'm running a script from the command-line php interpreter as follows:
> > (thanks to D. Souza for lead)
> >
> > $text = `usr/local/bin/php /path/to/my/php/page.php`;
> >
> > within the read file I want to enable sessions, so I session_start() at
the
> > top of the page:
> >
> >  > session_start();
> > ?>
> >  > code to execute here...
> > ?>
> >
> > Regardless of how I mess around with placement of session_start(), I get
a
> > "Headers already sent".
> >
> > Why? Nothing has been output to the browser within the read file!
> > Furthermore, if I create a test page with just:
> >
> > 
> >
> > Still receive "Headers already sent".
> >
> > My eyes are completely fried -- anyone feel like saving my vision?
>
> This often is difficult to detect when there's is implicit output
> outside of the  script and see if there is any whitespace or newlines preceding the tag.
>
> HTH,
> Rob.
> --
> ..
> | InterJinn Application Framework - http://www.interjinn.com |
> ::
> | An application and templating framework for PHP. Boasting  |
> | a powerful, scalable system for accessing system services  |
> | such as forms, properties, sessions, and caches. InterJinn |
> | also provides an extremely flexible architecture for   |
> | creating re-usable components quickly and easily.  |
> `'

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



Re: [PHP] session_start() || shell access problem......

2003-09-20 Thread Robert Cummings
On Sat, 2003-09-20 at 15:46, CF High wrote:
> Hey all.
> 
> I'm running a script from the command-line php interpreter as follows:
> (thanks to D. Souza for lead)
> 
> $text = `usr/local/bin/php /path/to/my/php/page.php`;
> 
> within the read file I want to enable sessions, so I session_start() at the
> top of the page:
> 
>  session_start();
> ?>
>  code to execute here...
> ?>
> 
> Regardless of how I mess around with placement of session_start(), I get a
> "Headers already sent".
> 
> Why? Nothing has been output to the browser within the read file!
> Furthermore, if I create a test page with just:
> 
> 
> 
> Still receive "Headers already sent".
> 
> My eyes are completely fried -- anyone feel like saving my vision?

This often is difficult to detect when there's is implicit output
outside of the http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



[PHP] session_start() || shell access problem......

2003-09-20 Thread CF High
Hey all.

I'm running a script from the command-line php interpreter as follows:
(thanks to D. Souza for lead)

$text = `usr/local/bin/php /path/to/my/php/page.php`;

within the read file I want to enable sessions, so I session_start() at the
top of the page:




Regardless of how I mess around with placement of session_start(), I get a
"Headers already sent".

Why? Nothing has been output to the browser within the read file!
Furthermore, if I create a test page with just:



Still receive "Headers already sent".

My eyes are completely fried -- anyone feel like saving my vision?

--Noah

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