Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    PHP


SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





Change File Permissions


i'm trying to create a file management tool online using php. Everytime i copy or create files or folders though it assigns ownership of the new files or folders to the apache id. i tried using backticks, exec, shell_exec and the php shell commands. php safe mode is off.

i can create the files and folders using shell commands and have tried to change ownership using chown but that doesn't seem to do anything. any insight can help. the goal is to be able to create these files with the same admin user ownership as all the other files on the site.




View Complete Forum Thread with Replies

Related Forum Messages:
Change File Permissions On Uploaded Files?
I am trying to find a way to change the default file permissions for uploaded files using PHP. When I upload a file using my PHP script the default file permissions are 755. I would like the file to have 744.

View Replies !
Change Permissions On Files
I understand that chmod(); is to change the permission on folder, but is it also used for changing file permissions? I need to take the images my users upload and change their permissions so they can delete them.

View Replies !
Change Permissions To Allow Mkdir() But What About Security
When users register with my site I want to create a directory where I can store certain user files. This gives the user the ability to have a 'neat' domain name like URL instead of something like URL

I have been successful using the mkdir() function in my scripts but I need to give write permissions to the URL directory as has been suggested in all the submissions to this forum.

Is it safe giving write permissions to the site's main directory?
If not is there another way to create a sub-directory without giving up any security?

View Replies !
Session Permissions Change Without Warning (HELP)
I run Apache2 and PHP5 and most of the time it works fine with my scripts.

Then occasionally, and it doesn't seem to make any difference when,
I'll get php session errors, saying that that permission is denied.

I've checked the /private/tmp folder (desig in php.ini) for permissions
and it's fine (drwxrwxrwt). But here's the weird bit. when I first hit
a website, it places a session tmp file in /private/tmp just like it
should, with permissions of:

Then suddenly without warning I'll get session errors from the PHP
scripts and the session files will have changed permissions to:

---------- nobody wheel

Does anyone have ANY idea why the session tmp files would change
permissions like that? Can't find anything on google and I'm stumped.

View Replies !
Change The Folder Permissions For Uploading To Work
I want my users to be able to upload images to my website. I think I need to change the folder permissions for this uploading to work, not sure how to do this though, I have tried the below but it doesn't work.

PHP Code:

$uploaddir = chmod("/images/directory", 0777);

Here is the code for the page:

PHP Code:

$uploaddir = "/images/directory"; // Where you want the files to upload to - Important: Make sure this folders permissions is 0777

View Replies !
How To Change Folder Permissions Without The 'security Tab'
I'm running windows, php version 3.4.1 and i am having a hard time initiating SESSIONS.

it turns out i should change the session.save_path c: emp permission to 'modify'

but my windows doesn't appear to show me a 'security tab' for me to do this.

can someone help me with an example of perhaps an ms dos command prompt, or an alternative way, or even a program to simply change the permission on a folder.

View Replies !
File Permissions
Im in the process of creating a web based frontend for a program called ASK (Active Spam Killer - http://a-s-k.sourceforge.net) and am currently running into a problem. Currently there is a perl based web front end, but it lacks functionality, and is rather bland, although it does work, and it works without changing any file permissions.

The problem im running into is that PHP requires me to make changes to file permissions (ASK files are located OUTSIDE of the web tree) which might end up causing problems as far as security and privacy of email. Has anyone come to any reasonable answer for this type of problem as im sure its a issue for other programs people write.

View Replies !
File Permissions....
I've read the stuff concerning writing to a text file and the related file permission issues on this forum.I have a script that does just that, it takes user-entered data from a Web Form and dumps it to a text file on a server.

This works fine on my private server, but is giving me the error...."Could not open stream.Permission denied on Line..." on the company server...The Company machine uses Windows XP.

I've tried talking to the System Administrator regarding the Permissions,but he says that giving READ/WRITE/EXECUTE Permissions could create Security Issues.

I have been told that previously,a script written in ASP had been used that did exactly the same thing i.e writing to the text file, but there were no File Permissions needed to be set!

View Replies !
4.3 And File Permissions
I know that the PHP "chmod" command sets file permissions, but how do I
retrieve what the permissions are for a particular file using PHP 4.3?

View Replies !
Problem With File Permissions : PHP / FTP
My php-script makes directories and puts files in it.
But via FTP'ing, I can't delete those files anymore.

Also, I need to put a whole bunch of existing files into these,
'made-by-php' directories, and that seems impossible
by means of FTP. I get an 'access denied' error every time.

View Replies !
How Can I Have Permissions To Delete A File?
How can I have permissions to delete a file? example: I have to delete a file, but I don't to public users have permission to delete that file but, with a certain "login" they can.

View Replies !
File Permissions After Copy()
This function basically creates a new dir in a determined location and copies the files from an established dir to the new dir. It copies the files and creates the folder ok, bit it sets the file permissons to 755 for the new folder and file contents. I then get a 550 error if I try to delete or chmod them. Any suggestions? I get permission errors in the script if I use the chgrp and chmod functions also. PHP Code:

View Replies !
How Do You Create A File In PHP And Set Permissions To It?
How do you create a file in PHP and set permissions to it?

View Replies !
File Permissions In Win98
I just wanted to know if there was any way I could change my file permissions so I can use the fopen function in windows 98 using Apache and PHP 4.04???? I know how to do it for Linux but I need it for Win 98.

View Replies !
CHMOD File Permissions
i have a few question about file permissions. which is the best way to set a permission to a mp3 tha ti can play on the website, but if anyone try to get it from the directory they wont be able to?

like if i am playing thissong.mp3 and someone went to the directory to try and get the file music/songs/thissong.mp3 they would get some kind of error. also for folders that don't have a index file. which permission would be the bes tinstead of creating a number of index for each, but not give a use permusic to see the context if the go to mydirectory/functions/ .

View Replies !
File/folder Permissions
I have an upload function that uploads images into a folder. The folder is set to 777. However when I upload an image file to the folder, the file uploaded is set to 600. Therefore it wont appear on web. I'm not sure why this is doing this for??  Im using the php function move_uploaded_file to upload the file.

View Replies !
File Write Permissions
I'm trying to get an open source PHP app working for my company.  It's giving me the following custom error:

FreeMED was unable to create a file to record the healthy status of the system.
The FreeMED directory should be owned by the user that the webserver is running as...
Usually this is 'apache'. You can also fix this by giving universal write access to the home directory of FreeMED.

But that is not advisable from a security standpoint.
I've narrowed it down to the line of PHP that's breaking it here:

$test = CreateObject('FreeMED.FreeMEDSelfTest');
As far as I can tell, I've made the directory it's using as open as possible and it's still giving me that error.  The owner is apache (user and group) and the permissions are (temporarily) set at 0777 (universal read/write).

Is there some PHP or Apache configuration that needs changed to allow PHP this kind of permission?

View Replies !
File Permissions Windows
i am using the LOAD DATA INFILE to load from a txt file. Although it works fine with the MySQL command it does NOT work with Script...does anybody know why?

View Replies !
Rsync And File Permissions
Im sort of new to using rsync to transfer my files. unfortunately it is messing up something with the permissions, and somehow i get a 403 from the server.

View Replies !
File Permissions On Upload
I am uploading picture. This is part of the code

if(!move_uploaded_file($_FILES['fullSizePic'.$propId.$i]['tmp_name'], '../images/properties/'.$imageName) ){
chmod('../images/properties/' . $imageName , 0777);
}

The file uploads and moves into the properties folder. That folder's chmod is 777, but the file's chmod is only 600 making it unreadable by the server. I try to chmod it with php (as you can see above) and it doesn't work.

View Replies !
Not Enough Permissions To Delete A File
I want to delete a file using unlink() function. I'm getting a warning that says that I have no permissions to do that.

I suppose that is because the file I'm trying to delete is under the root directory path. I searched the forum about deleting files but found nothing alike my problem...

View Replies !
Upload File Permissions Problem
I've moved an existing site (which I didn't write) from a apache/php/mysql
host under windows to a linux apache/php/mysql host.
I've sorted out most problems except one.

There is an upload function on the site, which uploads files via POST to
temp folder and then moves it into a folder on the host using php function
move_uploaded_file. Under windows this works fine but on the linux host the
uploaded file is created with 600 permissions so it cannot be accessed later
by site visitors. The folder it is uploaded into has 755 permissions. Is
there a way of setting the default file permissions so each uploaded file
can be set to say 644 or do I need to chmod each file after upload?

View Replies !
File Permissions Of PHP Session Files
I noticed that the file permissions (unix) of the PHP session files
have only read and write permissions for the Apache process (600 or rw-
--- ---).

Does anyone have any idea where this permission is set ? I can't find
any
umask or chmod settings for it in the php.ini file. Can't find
anything in
the httpd.conf either. Is it set in the PHP code that implements
session_start()?

View Replies !
Creating A File, Uploading, And Permissions
I'm using php4 and i want to check for a file, if it doesn't exist it
should be created. My problem is i have to create it with specific
permissions specifically 666 so that the script can then write to it. I
don't have ftp access. I'm also looking for any tutorials, recent ones,
using php4 for creating file upload areas, i'm trying to make one of those
as well.

View Replies !
File And Directory Permissions For PHP Application
I make the directory 0777 and then write the file then i make the file i tried a few but they keep from being read im sure the file is ok i think i can handdle file permissions but i think its directory permissions im having a prob with.

Its an image file i write it and then need to use it so make the directory 0777 and then write the file and then what to the file and what to the directory ?

i am using php ftp() but if anyone knows any differences with php chmod() then please tell me apart from that i do a 777 righth now and leave it at that.

what should i being to the directory and file after to make it secure because i dont whant people tampering with them ?

OH AND THIS PROBS ON TH MAC OSX 10.4 TIGER

my chmoding works fine on linux the way it is 0777 and then a 655

+ somtimes i play with the permissions of the directory throgh the os GUI or the shell and i got it to tell me i dont have permissions in the OS but in PHP its ok is this coz PHP got ownership of it when i messed with the addtional BIT.

View Replies !
Minimun File Writing Permissions
I believe the chmod command -w- is write only, the minimum file writing permission but what is this in terms of numeric - chmod 755? or 777 .

View Replies !
File Permissions Denied Error
i'm using the following code to create a file. PHP Code:

$fn = "file.php";
    $FileHandle = fopen($fn, 'w+') or die("can't open file");
    $stringData = "Something";
    fwrite($FileHandle, $stringData);
    fclose($FileHandle);

when i check the file properties i can see that the file's permission is set to 644 so when i use the following code to delete it i get a permission denied error. PHP Code:

$myFile = "file.php";
$fh = fopen($myFile, 'w') or die("can't open file");
fclose($fh);

$myFile = "$file.php";
unlink($myFile);

what shall i do to set the permission to 777 when creating the file?

View Replies !
Chmod Mkdir And File Permissions..
I'm trying to create directories and move files with the right permissions. When I make a dir using mkdir I'm setting the permission to 777 to my folder variable $t2 below,

but when I check the chmod it's 755? When I copy files over to this folder the file permission are set to 644 and I can't even get rid of them on the server because it won't allow me to delete them. Is there anyway to set permissions to a file as you're using the copy function? Code:

View Replies !
What File Permissions To Keep Files Safe From Outside Users
My php source files should have what file permissions to keep them safe from outside users.I have chmod 711 but i want somefiles to be able to be downloaded eg txt,doc files.

View Replies !
Set Up The Permissions So That My Script Can Simply Fopen A File For Writing.
I am rather new to PHP and a relative newbie to Linux too.
I have a webserver at home (Apache 2.0.48 on SuSe 9.0, PHP4).
I have some scripts, one of them needs to be able to create logfiles
somewhere on my machine. It must also later be able to read from and write
to these files again.

Sofar I get a permission error. I tried chmodding 666 or 777 the directory
in which the files could reside, to no avail.
How do I set up the permissions so that my script can simply fopen a file
for writing. Or if that's not the issue, what am I doing wrong or
overlooking ?

The errors:
Warning: fopen(logfileslog1.txt): failed to open stream: Permission denied
in script1.php on line 142
Warning: fwrite(): supplied argument is not a valid stream resource in
script1.php on line 154
Warning: fclose(): supplied argument is not a valid stream resource in
script1.php on line 161
It's the first I am puzzled about, the 2nd and 3rd are a logical
consequence.

By the way, reading from and writing to a file I have previously created
myself with exactly the names I tried to get created by the script (echoed
the name, ok) is no problem at all.
So I don't think it has much to do with a safemode or open_basedir setting.
I also tried creating the scripts in the same dir the script itself resides.
Did not work either.

View Replies !
Linux File Permissions On Maildir, Apache User
i have the following problem. I am trying to create maildir
directories on the local filesystem then chmod, chown them to
courier:courier (for courier mail server). the courier mail server
reads and writes on these maildirs on the local filesystem and they
need to have courier:courier ownership. it does not work because the
directories are created with apache:apache ownership and apparently
only root can change ownership. My question is as follows. Is the
only solution to this problem to add the courier user to the apache
group?

View Replies !
Open A File To Store Some Date :: Permissions Dilemma
I want to open a file to store some data. However, when I use fopen('filename', w) I get permission denied. So, I've changed the permissions of the directory to get rid of the permission denied problem. Unfortunately, this seemed to require changing the directory to have permissions 777.

View Replies !
Upload All The Files And Change "permissions" To "755".
I just got a mini-poll php script, all it said was to upload all the files and change "permissions" to "755". i am totaly new to PHP and have no idea what "permissions" means or how to change it?

View Replies !
File Download Problem - Change A Binary File Into A Text And Open It In A Browser
I have uploaded files to mysql (doc and xls) using the tutorial. The problem comes when I try to download. Again I followed instructions in the tutorial. When I click on the link to download the file, it formats it as text and sends it to the browser instead of seeing it as binary and offering me a download box. PHP Code:

<?
if(isset($_GET['id']))
{
    include 'includes/configdb.php'
    include 'includes/opendb.php'

    $id      = $_GET['id'];
    $query   = "SELECT name, type, size, content FROM upload WHERE id = '$id'";
    $result  = mysql_query($query) or die('Error, query failed');
    list($name, $type, $size, $content) = mysql_fetch_array($result);

    header("Content-Disposition: attachment; filename=$name");
    header("Content-length: $size"); ....

View Replies !
How To Change A File Name
i want to change the name of an uploaded file from:myant.jpg -> to -> ID123.jpg
how do you do it?

what i want is to make a mysql database with pics but i don't want to load the pics on the database. i want to change the name of the picture to a picture_id name (and store the picture info on a table). otherwise i could never load another pic with the same name in a directory.

View Replies !
File Upload Name Change
Does anyone know how to change the name of the file you're uploading to a server?

View Replies !
Change File Name On Upload To DB
Is there a way to change the file name when uploading filenames to a db to prevent over writting of duplicate names? Thinking of either adding microtime to the file name or something? Code:

View Replies !
Change The Index File With Php
how can I change the index file saying "Under Construction" or what ever by using php. then I can login to the admin pane and change it back. Any  ideas?

View Replies !
Auto Change XML File
I'm using the SimpleView gallery on my website. You put a photo in the images directory and add an entry into the gallery XML file.

Example Entry:
<image>
<filename>Imagefile.jpg</filename>
<caption>Caption 13</caption>
</image>
What I want is an easy way for members to upload their own images without having to manually change the XML file.

Basically the page will have a Browse field for the image upload and a enter caption field. Then a submit button to make it all happen.

How can i code the page to add an XML entry based on the file uploaded? If it'd be easier to use a specific file uploading system, i'm open to that too.

View Replies !
Change Settins In .ini File
I am facing a little problem, on my server php is configured with register_globlas off setting, but now i want to on this setting, i used ini_set("register_globals","On"); command to on this setting but stillit is off. Can any body guide me how i can make this settingon. I also used .htaccess file to on this.

php_flag register_globals on
php_value register_globals 1

but both are not working.

View Replies !
Change File Ownership
I have a phpscript that create some thumbsnails and now I want to make some new thumbs in a different size by overwriting the old ones. The problem is that during a serverchange I uploaded all the thumbs manually from the old to the new server. Now I get writing forbidden by all the thumbs I uploaded myself but not the newer ones that are created by php. How do I force php/apache to let me overwrite files that have a different owner?

View Replies !
I Need To Change My File Extensions To Php
I am installing an affiliate scrip at my site. However, it says I need to change several pages to a php extension so it can track the affiliate sells. The problem is that those pages have a Google PR3, and if I change the file from html to php I'll loose my PR.

View Replies !
Upload A File And Change The Name.
i want to upload a file and change the name.

View Replies !
.php Files - Permissions Are Set Public Readable - So Can Public Get To See Actual Raw File?
As a newbie to PHP is it in anyway possible for a casual web surfer to
actually get to see the PHP behind my .php file.

E.g.

if index.php contained PHP code to check if the page had been called with a
variable such as "password", is there anyway a public member can get to see
the raw php file and therefore see what the password is?

index.php might be:

if ($_REQUEST[password]="secret") {[color=blue]
>Then show one page[/color]
else[color=blue]
>show another page[/color]
}

So if a user visits with
index.php?password=secret

they get to see the secret page.
But as the index.php has to have file permission set so that anyone can read
it, I'm worried that the public can just somehow view the file and learn the
password.

View Replies !
Can Php Change The File Size Of An Image?
Is it possible to use php to scale down image sizes? for example an 800 by 600 pixel image is uploaded to the server and then PHP scales down the image to say 400 by 300 pixels?.
I know that it can generate graphs and things like that but can it change the actuall size of the image?

View Replies !
Database File Change Time
Is there a specific function to check whether the content of a database is changed. like for file we have filemtime function to check when the file was lastr modified. Similarly is there a function to check it for database table or i can use filemtime function to check the last modified time.

View Replies !
How To Change Name Of Uploaded Image File?
I'm using the following script to upload an image to my server. It uses the script: fileupload-class.php:

<snipped url>

It's working fine except it uses the uploaded file name when placing the file into my web server folder. I would like to change the filename before it is copied to the folder.

I've tried everything to figure out how this is done. I've had no luck. Would someone be able to tell me where in the script I can change the name of the file before it is copied into the folder on my server? (i.e., agent_image_001.gif)

<?php
require("fileupload-class.php");
$path = "agent_images/";
$upload_file_name = "userfile";
$acceptable_file_types = "image/gifs";
$default_extension = "gif";
$mode = 1;
if (isset($_REQUEST['submitted'])) {
$my_uploader = new uploader($_POST['en']);
$my_uploader->max_filesize(20000); // 20 kb
$my_uploader->max_image_size(200, 150); // max_image_size($width, $height)
if ($my_uploader->upload($upload_file_name, $acceptable_file_types, $default_extension)) {
$my_uploader->save_file($path, $mode);
}
.........

View Replies !
Change Variable In Config File
Is there an easy way to change a variable in a config file using PHP? I'm trying to add a setting adjusted by radio button on an admin page. When the admin clicks save I want it to change just that variable between "0" and "1". It seems like it should be a simple thing that is done all the time.

View Replies !
Dynamically Change Text Within A Php File
I have a php file like, for example

File1.php:

$str="this is static";
echo $str;

Now I want to include this file in another file (file2.php), but I want to change the value of $str (in file1.php) from file2.php. Is this possible?

View Replies !
Edit And Change A Word File
it's possible to open, edit and change a Word document that's accessed online. I want to open it, make changes then save the changes to the file online, rather than saving as a new file on my pc and re-uploading it.

View Replies !
Change Image File Size
i have a form that allows users to up load images. the code is set to end and give an error message if the file is bigger then the set peramitor. is there php script that can reduce the image file size when the user try to upload the file.

View Replies !

Copyright © 2005-08 www.BigResource.com, All rights reserved