神奇的没法解压之shell_exec

WBOY
Release: 2016-06-13 11:10:06
Original
900 people have browsed it

神奇的无法解压之shell_exec
php:

<br />shell_exec('sudo sh /var/www/wode/shell/update.sh');<br />
Copy after login

sh:
<br />#!/bin/sh<br />tar -zxvf update.tgz<br />#cp /var/www/wode/shell/update.sh /var/www/wode/tmp/<br />
Copy after login

shell目录下 update.sh update.tgz 
php执行之后没有把update.tgz解压 以为是shell的问题 但试了试其他的命令就可以 什么个情况?

shell php
------解决方案--------------------
/var/www/wode/shell/ 没权限吧,php是什用户组,目录又是什么用户组……
------解决方案--------------------
把update.tgz写成绝对路径试试看。在浏览器上用php执行的时候,当前目录是php的脚本目录,用cli模式执行时,当前目录是php二进制文件的目录。而并不是你那个shell脚本的所处目录。
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template