going crazy with mysql system call
Posted: Mon Feb 15, 2010 1:25 pm
Hi everyone,
I have been trying to figure this one out for days now. What I want to do is execute the following command from a PHP script that doesn't have root-level permissions:
system("mysql DBNAME < FILENAME"); // Load mysql dumpfile into database
Running this from the command line works fine (as I have root permissions) but from the PHP script it does nothing. I tried adding the following line in the sudousers file:
username ALL =NOPASSWD: /usr/bin/mysql
but it seemed to have no effect. I've tried every combination of chmodding and chowning the script to no avail. I've even tried using sudo commands and shell_exec to work around the permissions problem.
Has anyone gotten this to work?
I have been trying to figure this one out for days now. What I want to do is execute the following command from a PHP script that doesn't have root-level permissions:
system("mysql DBNAME < FILENAME"); // Load mysql dumpfile into database
Running this from the command line works fine (as I have root permissions) but from the PHP script it does nothing. I tried adding the following line in the sudousers file:
username ALL =NOPASSWD: /usr/bin/mysql
but it seemed to have no effect. I've tried every combination of chmodding and chowning the script to no avail. I've even tried using sudo commands and shell_exec to work around the permissions problem.
Has anyone gotten this to work?