Re: Call PHP script from MySQL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Mário Gamito wrote:
> Hi,
> 
> Is it possible to call from within MySQL an external PHP script ?
> I've read "MySQL Stored Procedure Programming" from O'Reilly but found
> nothing :(
> 
> How can I do this ?
> 
> Any help would be appreciated.

Could be that a Trigger does what you want?
http://dev.mysql.com/doc/refman/5.0/en/triggers.html

But I'd suspect that you probably want to use a MySQL function to do this:

e.g. SELECT SYSTEM('/usr/bin/php /path/to/my/script');

I'm not 100% sure if such a function exists, but if not it's would be a
fairly trivial UDF to implement:
http://dev.mysql.com/doc/refman/5.0/en/adding-udf.html


I'd be very careful tho', as creating such a UDF opens up a potential
minefield for SQL injection attacks!! If it's only one script you want
to execute, then it would be better to create a specific function that
calls that and only that and doesn't accept arguments and doesn't have
any nasty side affects if it's run in an ad-hoc manner.

There may be better solutions and it may be that this could be
implemented in other way if you look at it differently.

Col

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux