Re: using the Archive_Tar
| From: | Dennis Sterzenbach | Date: | Tue, 28 Oct 2003 13:11:56 +0000 |
| Subject: | Re: using the Archive_Tar | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-8644@lists.php.net to get a copy of this message | ||
Romain Valette wrote:
And the browser when i launch the php file say: Don't work I don't understand because the index.html exist and the pear.conf also exist. It's not just that the files have to exist.PHP needs to have read access to them. So if you are running the webserver (and the PHP, too) running chrooted, you may not access the /var/ path. Try if your PHP can access the files. Best way is to write a test script, eg. <?php if (fileperms("/var/www/index.html") !== false) {
print('I can access the file.');
print('And Its size is '.filesize("/var/www/index.html"));
} else {
print('Cant access');
}
?>
If you see the filesize and "I can access" message, everything
about this is doing ok.
The other possible reason then is, that PHP may not write to the
path you want it to create the .tar in.
You also should and can check this easily:
<?php
$fh = fopen("/path/Testfile.html", "w") or die("no write access");
fclose($fh);
?>
If you want to check write access to the current path, leave
out any /path/ in the fopen() parameter.
Another question: The php file is in the directory /path. So it will create the data.tar in the /path and if i want to create relative path, i start in the directoty path? why don't you try?afaik you don't have to give the path if you want PHP to create a file in the path the script does run at. Example: you want to create a file in /www/my/path Your PHP script is stored as /www/my/path/mytest.php Then you don't need to specify a path. Also you should be able using relative path specification. So you could say new Archive_Tar("sub/mytest.tar") when you want the script stored under path /www/my/path/ to create the tar in the sub-directory "/www/my/path/sub/".
for example, in the directoty path/, I have two files: toto.html and titi.html I want to create an archive of these two files: so I can use : $files = array("toto.html","titi.html"); or I have to use absolute path: $files = array("/path/toto.html","/path/titi.html"); ? afaik you don't need no full-path (see example above).I'm not perfect, so please don't shout at me, if I told something wrong. -- Dennis Sterzenbach http://www.darknoise.de/