PHP/MySQL - Multiple queries at the same time

后端 未结 3 808
抹茶落季
抹茶落季 2021-01-28 15:10

I have 24 databases with a table labeled email_queue.

I have another database with a list of all the databases that have the email_queue table

3条回答
  •  南笙
    南笙 (楼主)
    2021-01-28 15:35

    In your script try this.

    1. Use set_time_limit(0); in order to override PHP's max_execution_time
    2. Use the getopt() function to get the database name when the script is ran from the command line (i.e. php script.php -d database1).
    3. From there do the logic.
    4. In your crontab make an entry for each database you would like to send emails from using the switch (-d) I specified in 2. If you have 20 databases then you must have 20 entries.

    Using this way you will see a separate PHP process for each cron job and you can isolate a database if ever you will encounter an error with it.

提交回复
热议问题