[_] php and mysql loading sql query from file
rickhurst at linuxmail.org
Mon Oct 6 11:52:46 BST 2003
From: Oliver Humpage <oliver at watershed.co.uk>
> Could you use PHP to run a shell command, e.g.
> $result = `mysql -u username --password=yourpass dbname <
> Although you'd end up with your password visible via ps -aux. Ick.
From: "James Thorpe" <james at tfxsoft.com>
> I'm not aware of any functions in PHP that would let you call mysql in
> this way. The best thing you could probably do is write a function that
> opens a file, reads its contents and returns it as a string, then just
> call it like:
cheers for your suggestions, looks like i'll have to get PHP to do the file reading, I was just trying to find a way that the sql query files would be sitting securely on the database server and the php account (running on a seperate box) would have no direct access to the files, other than the file names and telling mysql to execute their content.
never mind, i'm probably getting too carried away with the security model!