0

I have successfully set up an AMP server (Apache, MySQL, and PHP) and have installed my Content Management System (Joomla!), which I am using to make a small website. The CMS connects to MySQL whenever someone connects to the site to get the page. However, I want to make a command run (yes, a normal GNU/Linux command, not a MySQL command) run whenever a database connection is made. I don't care if this means modifying a MySQL server setting or running a script on a forever loop that checks for database connections (which I am willing to do). How would I go about doing this? Thanks. (P.S. The system is running MySQL 5.5.)

0

Probably there are better solutions, and i don't know if this would be an optimal solution for you, but one way to accomplish this would be to simply call shell_exec() after each mysqli_connect():

$link = mysqli_connect('127.0.0.1', 'root', '', 'db');
shell_exec('<command>');
|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.