The first command returns this:
rwxr-xr-x 1 root root 7429677 Mar 9 08:02 /usr/local/bin/php
while the 2nd command returns a LOT of stuff. I still don't see how all of this works.
The first command returns this:
rwxr-xr-x 1 root root 7429677 Mar 9 08:02 /usr/local/bin/php
while the 2nd command returns a LOT of stuff. I still don't see how all of this works.
It shows php is available and you can run it.
OK, getbrowser.php has this code:
<?php
//print_r( get_browser() );
echo get_browser($_SERVER['argv'][0]);
?>
main.php has this code:
<?php
$info = `/path/to/dir getbrowser.php`;
print_r($info);
?>
/path/to/dir is the path to browscap.ini as well as php.ini and the scripts I am running (getbrowser.php and main.php). Same problem. No errors and no output.
Ok, this works fine for me.
getbrowser.php
<?
print_r( get_browser( $_SERVER['argv'][1] ) );
?>
testscript.php
<?
echo '<pre>';
echo 'Trying '."/usr/local/bin/php -c ./php.ini gb.php \"$HTTP_USER_AGENT\"\n";
passthru( "/usr/local/bin/php -c ./php.ini gb.php \"$HTTP_USER_AGENT\" ",$ret );
if( $ret !=0 )
echo "passthru failed $ret";
else
echo 'passthru worked' ;
?>
It only echo's the data to the screen, but I am sure you can work out how to parse the data.
That script returned this:
Trying /home/public_html/scripts -c ./php.ini getbrowser.php "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.0.3705; .NET CLR 1.1.4322)"
passthru failed 126
You are taking out the call to php and replacing it with /home/public_html/scripts
Just cut and paste what I posted and it should work if the two files are in the same dir.
I think I'm getting closer. This time the script returned this:
Trying /usr/local/bin/php -c php.ini getbrowser.php "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.0.3705; .NET CLR 1.1.4322)"
Could not open input file: getbrowser.php.
passthru failed 1
Is getbrowser.php is the same dir?
You could try ./getbrowser.php otherwise.
main.php
getbrowser.php
php.ini
browscap.ini
all those files are in the same directory, which is /home/scripts
Getting closer.
Try replacing this line
echo 'Trying '."/usr/local/bin/php -c ./php.ini getbrowser.php \"$HTTP_USER_AGENT\"\n";
with
echo 'Trying '."/usr/local/bin/php -c ./php.ini /home/scripts/getbrowser.php \"$HTTP_USER_AGENT\"\n";
That returns this:
Trying /usr/local/bin/php -c ./php.ini /home/scripts/getbrowser.php "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.0.3705; .NET CLR 1.1.4322)"
Warning: get_browser(): browscap ini directive not set. in /home/scripts/getbrowser.php on line 13
passthru worked
You obviously have been changing this line as well.
passthru( "/usr/local/bin/php -c /home/scripts/php.ini /home/scritps/getbrowser.php \"$HTTP_USER_AGENT\" ",$ret );
It must need the full path for both php.ini and getbrowser.php
I didn't know both needed the path, that's what confused me. It now shows:
Trying /usr/local/bin/php -c /home/scripts/php.ini /home/scripts/getbrowser.php "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.0.3705; .NET CLR 1.1.4322)"
passthru worked
Now what do I do?
Put some debug in getbrowser.php
Probably
phpinfo();
print_r( $GLOBALS );
This will give you a good idea of what is happening.
Ok -- I have to say, thanks a LOT for all of your help!