Re: Could someone look at my problem in shell-exec?
| From: | love jiangnan | Date: | Fri, 23 May 2003 18:33:05 +0000 |
| Subject: | Re: Could someone look at my problem in shell-exec? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-148805@lists.php.net to get a copy of this message | ||
Thank you very much for your great help.
I am trying to put my tar file into /tmp directory
which is available to all users and return it to the
user.
$output=`cd /tmp; tar cvf output.tar
$home/www/1989/01/01.txt; ls; tar uvf output.tar`;
echo<pre>$output</pre>;
This time, the webpage list the files in tmp including
the tar file. However, it is not the /tmp which I see
from server. I have no idea which directory it
opened. Meanwhile, it cannot tar uvf output.tar.
Do you think it is because php did not understand the
path and alias of my machine? What exactly /tmp it
refer to? Should I input the whole path from the
root?
Thank you again.
--- Ernest E Vogelsinger <ernest@vogelsinger.at>
wrote:
> At 22:34 22.05.2003, love jiangnan said:
> --------------------[snip]--------------------
> >All the files are under my own directory and
> created
> >by myself.
> >
> >could you tell me how can I give user permission?
> Or
> >should I talk to admin to give user permission?
> --------------------[snip]--------------------
>
> Create a subdirectory in your home directory, e.g.
> "webcache". Then make it
> world-writeable:
> mkdir ~/webcache
> chmod 777 ~/webcache
>
> Now create a small script that creates a file in
> webcache (you must use the
> full path to that directory, the webserver doesn't
> know about your "~" home
> shortcut):
> <?php
> $hf = fopen('/home/jiang/webcache/test',
> 'w');
> echo 'Creating the file ', ($hf ?
> 'succeeded' : 'failed');
> ?>
>
> After running this script once there should be a
> file in ~/webcache. Try to
> list it:
> ls -l ~/webcache
> -rw-r--r-- 1 apache www 0 May 22 22:50 test
>
> Now you see which user and which group the web
> server uses - in this
> example it's the user "apache", group "www" (most
> probably different at
> your site).
>
> Since you don't want the webcache directory to be
> world read/writeable,
> change its GID to the web servers GID, then remove
> the dangerous world rights:
> chown :www ~/webcache
> chmod 770 ~/webcache
>
> Now you and the webserver will be able to read and
> write to ~/webcache, but
> no one else. (Of course you may delete the "test"
> file after that...)
>
> Hope this helps,
>
>
> --
> >O Ernest E. Vogelsinger
> (\) ICQ #13394035
> ^ http://www.vogelsinger.at/
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com