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.





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 Complete Forum Thread with Replies

Related Forum Messages:
Write Permissions
if i ftp to a site and teh structure is this:

top folder - no write permission
subfolder of top - allow write
sub sub folder of top allow write

shouldn't i be allowed to write to database if my database is in the sub sub folder?

View Replies !
Apache Php Write Permissions
I have two webservers. I can run php code fine on one but not the
other. Both webservers can read files only one can write. I have looked
around at other posts and they point at not giving permissions to the
apache user.

I have chmod 777 the directory /var/www/html and the subdirectory test:

View Replies !
Apache Needs Permissions To Write In
I have a script designed to read a number of images and make thumbnails of them. These thumbnails are stored in /thumbs/ as tn_filename.jpg. And so apache needs permissions to
write in ./ so it kan create thumbs and the files therein.

But I also want to upload pictures directly to ./ with FTP/SSH without logging in as apache. Code:

View Replies !
Is_writable Problem - Set Write Permissions? With Chmod?
I have a problem fixing an upload script by implementing the opensource project webcollab. By setting the upload directory to a certain folder in the config.php file, the whole thing should work, but it does not. It says that write permission for the folder should be set properly. I assume the folder is correct(heej i am not such a big idiot ), so the problem is the write permissions. I assume it is not in the script, since the version of the project is stable.

Question:
How do I set these write permissions? With chmod? Or is this more a kind of thing that the server admin should set?

View Replies !
Changing Write Permissions Of Files And Folder
i want to make the files and folder in my server write protected. i want to change the file read write permissions dynamically so that i canĀ  change the write permission of the folder and upload files to it and again make the folder write protected.

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 !
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 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 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 !
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 !
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 !
PHP/IIS: File Read/Write OK, File Unlink Denied
I've got PHP running fine on IIS (OS: Server 2003, SP1; IIS: 6.0; PHP:
4.3.11).

In PHP, the user uploads a file, which is then processed and the
contents are inserted into a new file, created in PHP, onto the server.

This bit works fine, the new file created by PHP is correctly stored.

Later, once the user confirms the upload and PHP inserts the contents
of the file into the DB, the code tries to remove the file created in
PHP moments earlier, via the unlink() function.

What I see on screen is the following: Permission denied

I have made sure that the permissions for the Internet account that
created (and is trying to delete) the file have full permissions over
this particular folder and the files within it. But the user must have
permission anyway, because they are able to create this file in the
first place.

I've looked at the permissions for the file in PHP, which read: 0666.
So everthing *appears* ok to me; I can't see where the permission issue
is coming from.

View Replies !
Write To File Sometimes Deletes EVERYTHING, Leaving Empty File
I've used PHP to save raw data from Flash to an XML in the past. Load the XML into flash, update a couple variables, then send it to PHP to completely overwrite the old .xml file. This works great most of time, but sometimes after a few days, I'll check the .xml and it will be empty (0 bytes).

Not sure if this is caused by a user who aborted during the writing process, or simultaneous connections, etc. Been thinking about doing a backup every day using CRON, but that's a mission and I'd like for it not to happen full stop. Any suggestions?

View Replies !
How Can I Make The Script Write File.php At The Beginning Of The File?
How can i make the script write file.php at the beginning of the file without overwriting the exisiting text?I tried using rewind($file); but it still overwrites.

$text = stripslashes($text);


$write = "<br> $text <br>
";

$file = fopen('file.php', 'r+',);
fwrite($file,$write);
fclose($file);

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 !
Specifying Where To Write In A File?
Is there any way to specify a spot in the file that you want to write to? Instead of just adding it at the end or beginning?

View Replies !
Best Way To Write And Add To A Xml File?
i want to know wha tis the best way to write and add to a xml file? Code:

View Replies !
Using PHP To Write A PHP File
I'm writing a PHP application that has a component that writes other PHP files. I have the fopen, fwrite, and fclose all working correctly. The problem is, is that when it writes the new PHP file, and I open it, my server throws a 500 error. When I open the new PHP file in a text editor, It looks like perfectly valid PHP. Here's my code. Code:

View Replies !
PHP Write To XML File
I'm trying to write to an xml file, but I don't want to overwrite anything, just append the file. Also, I have to create the new line on line 2 as illustrated:

<threads>
<thread subject="ONE SMALL STEP" date="08.01.02" body="TEST"/>
</threads>

So, the idea is to be able to add more and more threads on top of the current thread without overwriting older ones. So I'd need the file pointer to create a new line just beneath '<threads>'.

View Replies !
Write ?> To A File.
I'm trying to write a setup script which creates a php file with all the settings in it.
It writes "<?php" at the beginning with no problem but when I use PHP Code:

View Replies !
Write An .xml File
I am using PHP/MySql to store info for a XML formatted doc. I used the technique from www.gotoandlearn.com to produce XML with PHP. I added the ability to write the XML file that show up in IE and that works great. I recently made a change to have keywords in a separate DB because I need to have the keywords inputted separately in the XML. This XML file is used for SCORM compliancy based on the ADL website https://adlregistry.dtic.mil/ (https://adlregistry.dtic.mil/6/index2_7.htm).

The problem now is that when I run the script to produce the XML page via IE and write it into the xml folder it prints the keyword in IE but it will not write them in the .xml file. It writes all the other data but just shows the do while loop i have. Below is the code. To me it appears that the variable is not being reconized in the bottome write file portion of the code. This was done with Dreamweaver and Handcoding and reworked code off the internet.

View Replies !
Php Write To Txt File
I'm trying to write to a text file, but I want to add the text to the top of the file and leave the rest still in the txt file. I don't want it to append to the bottom of the file, nor erase what's already there. this is what i have so far in my php file.

<?php
$fn = "data.txt";
$file = fopen($fn, "a+");
$size = filesize($fn);

if($_POST['update']) fwrite($file, $_POST['update']);

$text = fread($file, $size);
fclose($file);
?>

View Replies !
Write To File Or Db
i'm setting up an error log for a new project. ordinarily, i've tried to write logs to an error file. it occurs to me that having the errors in a DB might be more convenient. on the other hand, what if you encounter a db error? where does the error go then? does anyone else have advice about where to put an error log?

View Replies !
Can't Write To .txt File.
So I recently installed/activated PHP5 and my SQL on my laptpop (macbook pro) and everything seemed to be working fine.

However, when I try to use it to write to a .txt file ( using fopen/ fwrite) I recieve the following Error:

"failed to open stream:Permission denied"

I have tried:

1/Using relative and absolute URLs to target the file.
2/Checking PHP is not running in Safe Mode.
3/Checked permissions on the .txt file and all other folders right up to my Sites folder.
4/Slamming my hand on the desk and throwing a biro at the wall.

But I am still stuck. I've done exhaustive searches for a solution, but all the posts which mention this Error message seem to either fail to resolve it, or resolve it by changing the chmods.

View Replies !
Write To FILE
<p> ALLOCATION TABLE </p>
<table>

<tr><td class = "header"> STUDENT </td>
<td class = "header"> TOPIC </td></tr>
<?
$filename = 'test.txt'
foreach ($studs as $v => $v2)
{
$content = $v.'=>'.$v2."";
?>
<tr>
<td><? echo $v.'</td><td>'.$v2 ?></td>

</tr>
......

View Replies !
Print To File Or Write To File?
Is it possible to have a php script that creates a text file on it's host server... something like a print to file or write to file? What I want to do is have a php script that creates a html file rather than just echoing text to the screen.

View Replies !
Write To A Text File Once Only
I've got a script that writes to a text file:

View Replies !
Write To File Or Use MySql?
I am laying out the data model for a small real estate site.

So far whenver I needed small databases, I just created regular files as tables, searched them and put out whatever I needed.

Works fine for small apps.

Have only held my nose into Mysql and it seems that I have to do the exact same searches, except there is an additional layer in between.

Now, assuming that the authors of mysql are really good at what they are doing (as opposed to yours truly) I would not lose any speed by using mysql.

But at what KB,amount of tables,.. size does it really make sense to use mysql rather then simply writing into a straight file?

View Replies !
Write An Array Into A File?
I want to write to a certain line of a file. Somebody suggested that I put the file into an array, modify a part of it, and write it back out. So for example if I were to edit file.txt's third line I would do. Code:

$content = file(file.txt);
$content[2] = "blah blah blah";

I am trying to write the array back into the file, but I can't seem to get it to work.
I tried to do this after the code above: Code:

$file_pointer = fopen("file.txt", "w");
fwrite($file_pointer, "$content);

But that didn't seem to work.

View Replies !
How To Use For Loop To Write To File?
All I want is a quick and dirty way
to populate a file with UNIX time stamps...

<?php
//viscount_helper.php
$vc = 'viscounter_test.txt'
$avdaily = 5; average daily
$total_count = (365 * $avdaily); //time period = one year
echo $total_count;
$interval = (86400)/$avdaily; //evenly spaced intervals
echo $interval;
$visit = time() - (31536000);
echo $visit;
//$next_time = ($first_time + $interval)
$fp = fopen($vc,"a");
for($i = 1; $i > $total_count; $i++)
{
fwrite($fp, $visit."
");
$visit = $visit + ($interval * $i);
}
fclose($fp);

View Replies !
How To Write To A File From A Form ?
i have a form with three text fields. how do i code in php so that the values in the fields, called f1,f2 and f3 will be saved into a text file as below . the next time i use the form, i want the code to add the values to the end of the file

f1|f2|f3
f1|f2|f3
f1|f2|f3

View Replies !

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