phpbuilder.com :
Date: 08/15/02 17:05
By: Matt L
Subject: RE: PHP and MySQL (and others) in command lin
AHA!
I've managed to do it, but in such a way that it can be considered cheating.
However, I haven't managed to get it to work in any other way.
Certain functions (like the mysql ones) seem to only work when accessed by the HTTP server (most likely due to the setup... Steve King has the right idea, allowing PHP to access MySQL directly)
So, what I did was use the php shell script to access a localhost web page that outputted the information I wanted using fpassthru.
Here's an example:
-- shell.php --
#!/usr/local/bin/php
<?php
$location = "http://localhost/tools/TimeSheet/notify.php";
$fp = fopen ($location, "r" );
fpassthru($fp);
?>
-- notify.php --
<?php
mysql_connect("localhost","root","" );
...
mysql_query(...)
...
//print out stuff that you want
?>
-- It may be hacky, but it works : )
Good luck.
|