How to execute a shell script in PHP?

前端 未结 4 1836
暖寄归人
暖寄归人 2020-12-03 01:16

I have a script in /var/www/myscript.sh which creates folders and runs the command svn update for my projects. I need to execute this script by calling

4条回答
  •  余生分开走
    2020-12-03 02:23

    Several possibilities:

    • You have safe mode enabled. That way, only exec() is working, and then only on executables in safe_mode_exec_dir
    • exec and shell_exec are disabled in php.ini
    • The path to the executable is wrong. If the script is in the same directory as the php file, try exec(dirname(__FILE__) . '/myscript.sh');

提交回复
热议问题