URL: https://linuxfr.org/forums/linux-redhat/posts/execution-script-shell-impossible-depuis-php Title: execution script shell ,impossible depuis php Authors: maxissof Date: 2009年01月30日T20:24:50+01:00 Tags: Score: 0 SALUT j'ai toujours pas réussi à exécuter mon application "smsicomd" depuis mon code php que ce soit avec exec, passthru ou system,; malgré les différents modifications (edition du sudo, chmod 755 , chown apache).en fait , je n'obtiens en lançant mon code php ds la barre d'adresse que les phrases qui suivent "echo" du script shell (smsicomd), du genre '"starting bearerbox, starting smsbox" si par exple dans mon code php j'ai la commande "smsicomd start".Mais dans les faits, l'application ne s'est pas lancé. Alors QU'EN LIGNE DE CMDE , la même commande la lance. Une autre possibilité , celle d'exécuter le script shell en mode cgi, se révèle aussi infructive, et pour cause , refus d'accès au repertoire /cgi-bin. Alors que je suis allé même chowner (apache) et chmoder (755) tous ce qui était contenu dans /var/www/. avez- vs une proposition pour moi? Enfin, voici mes deux scripts: code php script shell #!/bin/sh # # smsicomd This shell script takes care of starting and stopping # the Kannel WAP gateway (bearer/wapbox) # # chkconfig: 2345 97 03 # description: Start and stop the Kannel WAP gateway used to fetch \ # some WML content from a Web server & compile it \ # into WMLC mobile phone bytecode. # probe: true # Use start-stop-daemon ver=1.4.1 BBOX=/usr/local/sbin/bearerbox SBOX=/usr/local/sbin/smsbox START="/usr/local/sbin/start-stop-daemon --start --background --quiet --exec" STOP="/usr/local/sbin/start-stop-daemon --stop --quiet --oknodo --exec" CONF=/etc/kannel/kannel.conf [ $# -eq 2 ] && ver=2ドル # Source function library. . /etc/rc.d/init.d/functions # Source networking configuration . /etc/sysconfig/network # Check that networking is up. [ ${NETWORKING} = "no" ] && exit 0 [ -x $BBOX ] || exit 0 [ -x $SBOX ] || exit 0 [ -f $CONF ] || exit 0 RETVAL=0 smsicomd sleep 1 # Sleep for a while before we try to start smsbox echo echo -n "Starting smsbox service (gateway kannel $ver): " $START $SBOX -- $CONF RETVAL2=$? echo echo [ $RETVAL1 -eq 0 -a $RETVAL2 -eq 0 ] && touch /var/lock/subsys/smsicomd ||\ RETVAL=1 ;; stop) # Stop daemons. echo -n "Shutting down smsbox (kannel $ver): " $STOP $SBOX RETVAL2=$? echo echo -n "Shutting down bearerbox (kannel $ver): " $STOP $BBOX RETVAL1=$? echo [ $RETVAL1 -eq 0 -a $RETVAL2 -eq 0 ] && rm -f /var/lock/subsys/smsicomd echo "" ;; status) status bearerbox status smsbox exit $? ;; restart) 0ドル stop sleep 1 0ドル start ;; *) echo "Usage: named {start|stop|status|restart}" exit 1 esac exit $RETVAL