Linux php executer un fichier bash/mysql droi

xunil2003 Messages postés 765 Date d'inscription   Statut Membre Dernière intervention   -  
xunil2003 Messages postés 765 Date d'inscription   Statut Membre Dernière intervention   -
Bonjour,

Je suis sous Linux Debian Squeeze 2.6.39.4, J'ai créer un fichier bash avec des requetes mysql a l'interieur. Dans le terminal ça fonctionne, j'ai les droits, mais quand je veut y faire exécuter par php, ça marche pas et le fichier erreur.log de apache me dit que je n'ai pas les droits ? Quand je l'avais écrit en dur dans le fichier bas je n'ai pas eu ce problème .

Comment puis je ajouter l'user "www-data'@'localhost" a mysql pour qu'il est les droits ?
Comment faut il faire ?

Merci.

cat /var/log/apache2/error.log
/home/serveur/Domotique/ordres/e1-on: line 4: /mysql.sh: No such file or directory      
Enter password: ERROR 1045 (28000): Access denied for user 'www-data'@'localhost' (using password: NO)     
/home/serveur/Domotique/ordres/e1-on: line 100: insert.sh: No such file or directory     
Enter password: ERROR 1045 (28000): Access denied for user 'www-data'@'localhost' (using password: NO)     
Enter password: ERROR 1045 (28000): Access denied for user 'www-data'@'localhost' (using password: NO)     
Enter password: ERROR 1045 (28000): Access denied for user 'www-data'@'localhost' (using password: NO)     
Enter password: ERROR 1045 (28000): Access denied for user 'www-data'@'localhost' (using password: NO)     
Enter password: ERROR 1045 (28000): Access denied for user 'www-data'@'localhost' (using password: NO)     
Enter password: ERROR 1045 (28000): Access denied for user 'www-data'@'localhost' (using password: NO)     
/home/serveur/Domotique/ordres/e1-on: line 116: 2012-08-rapport-ordres.log: Permission denied     
Enter password: ERROR 1045 (28000): Access denied for user 'www-data'@'localhost' (using password: NO)     
Enter password: ERROR 1045 (28000): Access denied for user 'www-data'@'localhost' (using password: NO)     
Enter password: ERROR 1045 (28000): Access denied for user 'www-data'@'localhost' (using password: NO)


La ligne 3 du fichier bash
chemin_bash=$(which mysql.sh) ; # renvoyer le chemin où se trouve le script


La ligne 4 du fichier bash
source ${chemin_bash%/*}/mysql.sh # Insertion du fichier de connecxion a la basse de donnés mysql


La ligne 100 du fichier bash
source $(sql7)insert.sh


La ligne 116 du fichier bash
echo "$date2 - $heure - $utilisateur - $(sql1) - $(sql2) - $(sql3) - $programme" >> $(sql6)$date1-rapport-ordres.log


Merci.

A voir également:

2 réponses

Mihawk Messages postés 4315 Date d'inscription   Statut Contributeur Dernière intervention   846
 
Hello,

Attends... tu veux faire exécuter un fichier bash... par PHP ?!!
0
xunil2003 Messages postés 765 Date d'inscription   Statut Membre Dernière intervention   14
 
Bonjour,

Oui, Pourquoi ?

Merci.
0