dtjkl42086
dtjkl42086
2015-02-18 11:50

PHP exec不运行程序

已采纳

I want to start program when I enter my webpage, and problem is in permissions(??) because when I try

echo exec('whoami');

I've got valid response (www-data) but when i try code like it:

echo exec('/var/www/./sitesend');

and

echo passthru(/var/www/./sitesend');

I got no response. I tried to

chown www-data /var/www/sitesend
chmod 755 /var/www/sitesend

My C++ app runs correctly, and its sending by NRF infromations to turn lights. But not work, when enter page app won't run and I don't get any reps in echo.

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

1条回答

  • duanjiao1256 duanjiao1256 6年前

    I don't have a conclusive answer, but you can try a number of things:

    • Try the follow command to see if www-data may run the command.

      sudo -u www-data /var/www/sitesend
      
    • Try running a PHP script with the passthru command from the commandline.

    • See if you're running AppArmor for the Apache process. AppArmor will block execution for files not white listed.

      ls /etc/apparmor.d
      
    点赞 评论 复制链接分享