0

I am trying to create a MySQL trigger that will invoke a php script. I have a MySQL server instance running in RDS and would like to use the php script to send a message to my SQS messaging system.

  1. Where do I save the php scripts?
  2. Do I need to install the PHP SDK for SQS on my EC2 instance?
j0k
  • 22,600
  • 28
  • 79
  • 90

2 Answers2

1

Yes, you can use triggers normally. Use this steps:

  1. Change in "parameter group" menu the variable:

    log_bin_trust_function_creators to "ON" or "1".
    
  2. Do a "modify" and "reboot" at instance. MANDATORY!

  3. Verify with mysql client if the variable was really modified. The command is: SHOW VARIABLES LIKE 'log_bin_trust%'

Now, you can create your triggers normally. The great difficult is to check questions correctly: your instance should be use that parameter group, and this should be correctly set

j0k
  • 22,600
  • 28
  • 79
  • 90
0

Forget about triggers, especially on Amazon RDS.

Use a cron to execute a PHP script every 5 minutes (for example) that looks for unsent messages and sends them using the SQS messaging system.

CodeZombie
  • 5,367
  • 3
  • 30
  • 37
  • Any reason for suggesting not to use triggers? Is there a known issue with this? – user1481054 Jun 26 '12 at 17:43
  • I think triggers should be avoid whenever possible. Heavily used they make debugging a pain in the ass as they are executed in random order and you often don't think about it when you wonder why the changed data doesn't look as expected. – CodeZombie Jun 26 '12 at 20:55
  • Unfortunately, they are the only substitute on MySQL for CHECK constraints, which is a real shame – Asfand Qazi Mar 13 '14 at 11:32