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.





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

Related Forum Messages:
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 !
Writing Files And Permissions.
If Apache is running as the user "www" and "www" is part of my group "wheel" should'nt i be able to create files with php in a directory that has the permissions of 0775? It seems i always need to make the directory 0777 to write to it, which doesnt seem right.

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 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 !
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 !
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 !
File Re-writing And Moving The File Pointer
i have a text file that looks like this:

<bt>600</bt>
<iregno>123123</iregno>
<users>
<un>2</un>
<u1>
<n>Username</n>
<ema>username@domain.com<ema>
<s>password</s>
<t>user type</t>
<p>profile name</p>
<cat>000000000000000000000000000000000</cat>
</u1>
and so on
</users>

Now i run this big user edit function where im reading in their details and displaying them in forms and so on. They then edit the form fields and i read them back in using $POST. That's the easy part. What i then want to do is re-write a section of my text file.

I have a variable that tells me what user i need to re-write the details for, i also have all the new details that i need to replace the old ones with. So, in logical terms, what i need to do is move my file pointer to that section of the file:

read in $userToEdit variable -> output of variable is <u1> -> move file pointer to next line (<n>username</n>) and let me rewrite the next 6 lines therefore leaving the pointer at </u1> I hope that makes sense. Just basically want to rewrite the text that is there, not append/add.

View Replies !
Writing To A File
The script below writes to a file and sends back confirmation that all is well. That is working correctly. The problem I am having is when I view the blank data.txt file that I uploaded to the server (and yes, I have put the file permissions to rw-rw-rw) its still blank!!!!!!! despite my little script stating that all is well. The same script works perfectly well on the
totalise server. If the answer is to run the script as cgi I am too sure how to carry out the 7 different suggestions advised at the FAQ. I am OK at saving the script with a .pl or .cgi extsion instead of .php but how do I incorporate the extra line of code(#!/usr/bin/perl?) do I use it everytime I open php in the
script or just once at the start. What exactly is the base path and how do I check to see if it is set correctly. The script in question is: (basically it handles the data(an URL and a description) coming from a html form and writes these to a file(data.txt)

<?php
function WriteToFile ($URL, $Description) {
/* Function WriteToFile takes two arguments--URL and Description--which will
be written to an external file. */
$TheFile = "data.txt";
if(is_writeable($TheFile)){
$Open = fopen ($TheFile, "a");
if ($Open) {
fwrite ($Open, "$URL $Description
");
fclose ($Open);
$Worked = TRUE;
}
}
else
{
$Worked = FALSE;
}

return $Worked;
} // End of WriteToFile Function.
?>
<HTML>
<HEAD>
<TITLE>Using Files</TITLE>
</HEAD>
<BODY>

<?php
/* This page receives and handles the data generated by "form.html". */
$Pattern = "(http://)?([^[:space:]]+)([[:alnum:].,_?/&=-])";

if (eregi($Pattern, $Array["URL"])) {
$Replace = "<a href="http://23" target="_new">23</a>";
$Array["URL"] = eregi_replace($Pattern, $Replace, $Array["URL"]);
$CallFunction = WriteToFile ($Array["URL"], $Array["Description"]);
if ($CallFunction) {
print ("Your submission--$Array[URL]--has been received!<BR>
");
} else {
print ("Your submission was not processed due to a system error!<BR>
");
}
} else {
print ("Please enter a valid Web address!
");
}
?>
</BODY>
</HTML>

View Replies !
PHP Writing To A File Help
I am trying to create a script that will take the MYSQl DB details that have been sent from a form and store it in a file for usage at a later stage.

Am I doing this correctly:

View Replies !
Writing Csv Or Txt File
I am trying to create a method of exporting a csv or plain text file from a mysql database, so that users can save this file to disk for use in Excel or other popular spreadsheet & database applications.

I have a query which selects the records, and I can format it easily enough using HTML table and related tags... Does anyone know a good way to format the results of the query so users can save this file as txt/csv file?

View Replies !
Writing To File With Php
Currently working my way through 'PHP and MySQL Web Development' by Luke Welling and Laura Thomson and am having difficulty writing to file in one of the examples.

It throws up the following error:

Warning: fopen(c:inetpubwwwroot/../orders/orders.txt) [function.fopen]: failed to open stream: No such file or directory in C:InetpubwwwrootLearn PHP and MYSQLLuke Wellingprocessorder.php on line 64 Code:

View Replies !
Writing To A Txt File
i have to save some form data to a .txt file, using one of the form variables ( #studentid ) as the file name, e.g. if the #studentid submitted was 123 then the file would save as 123.txt.

View Replies !
File Writing
i hv a problem with my php script. i am learning php still but not new to programming concepts, just php. my script was spose to find a file in a folder,("/list/list.txt"). this was a test folder.and it was spose to write some simple data to it. i had this problem before.

The problem is,either it doesnt open the file for writing,or there is a problem i do not know about.

code (code contains html):
<?php
$Name = $HTTP_POST_VARS["Name"];
$Message = $HTTP_POST_VARS["Message"];
$outputMessage='<hr>'.' '.$Name .' '.$Message .' '.'<hr>'
$file='/list/list.txt'
@ $fp = fopen($file,'r+');
fwrite($fp,$outputMessage);
fclose($fp);
?>

View Replies !
Writing To A Log File
I am using the following code to allow the parameters entered to be recorded in a log then have the user redirected to the appropriote page. Code:

View Replies !
Writing To File
this is the code i use to write to the beginning of a file it reports an error what am i doing wrong, Error Warning: fopen(posts.php): failed to open stream: HTTP wrapper does not support writeable connections. in writetofile.php on line 4 Warning: fwrite(): supplied argument is not a valid stream resource in writetofile.php on line 8

<?php
function writetofile()
{
$file=fopen("posts.php","r+") or die(unable to open file);
$title = $_GET["title"];
$text = $_GET["text"];
$writte = "<h2> $title </h2>
$text";
fwrite ($file,$writte);
}
echo "Article has been successfully added!";
writetofile();
?>

View Replies !
Not Writing To File
I have a simple script I've written to log some information to a text file. Everything seems to be okay, the code isn't throwing any errors, but for some reason it isn't writing to file. Here's the code I'm using:

//trigger_error("Just Testing to see if this is working",E_USER_NOTICE);
$strTimeStamp=date("F j, Y h:i:s A");
$strLogEntry=$strTimeStamp . ", " . $REQUEST_URI . ", " . $_SERVER
['HTTP_REFERER']. "
";
//echo $strLogEntry;
$logfile='../logs/fce.log'

$logExists=file_exists($logfile);
if($logExists){
echo "File Exists<br>";
}
else{
echo "File Does Not Exist<br>";
}.......

View Replies !
Writing A Txt File By A Form
Hi,

I want to create a txt file containing the next content:

min=5
&max=8
&x=70

These are variables wich are needed by a Flash swf file. (The Flash swf file displays the weather forecast.)

I want to make a form which submit 3 values to a txt file called update.txt

How can I do this with php? I want to submit the 3 values with a form. Is it possible to do this more than once so the variables (or the whole textfile) can be updated?

View Replies !
Writing To A File...and Using A Password
does anyone know of a script that will enable me to write to a file i specify, but require a password to use the script at all? a toutorial would also be nice.

View Replies !
Reading And Writing From A File?
How would I go about reading and writing from a file? I would like to make a Web GUI for my sendamail virtualhosts.

View Replies !
Writing A Node To An XML File
I want to write a node or nodes to an existing xml document. I don't need to create a new document, thanks but no thanks.

Judging from various posted topics I've seen. It appears the php DOM for XML isn't quite there yet and has a lot of bugs. Not only that it takes a few months before web hosters update versions of php.

I tried the pear classes, but they're so poorly documented, there's no example, there's nobody you can contact at Pear for hlep. If you ask for help on forums, you get no reply's so obviously not many ppl are using these classes.

I wonder..... if there's a push from say mySQL to stall or slow down PHP's functionality for XML?

Any ideas on how to write a node or nodes into an existing XML file..... without a bunch a array manipulation?

View Replies !
Writing To A Text File
i have a text file with the number 250 in it and nothing else. i have a variable which is worth a 300. How can i add this value to the one in the file so that the value of the file has changed to 550?

View Replies !
Writing To The .htpasswd File?
is there a way to write the username/password to the .htpasswd file using a form in php, while also inserting into a mysql db...(i've already got the db part down)

View Replies !
Writing To The Begining Of A File Instead Of The End.
Appending a file and writing to the begining instead of the end.
Is there an easy way to do this?

View Replies !
Writing PHP To File W/fwrite()?
I'm trying to write this code to a index.php file when i generate directories on my site,

like:

PHP Code:
fwrite($handle, "
<?
$file = file('http://www.somesite.com/?page=sublist&cat=$row[cid]');
foreach($file as $line){
echo $line;
}
?>
");
fclose($handle);

which seems to kind of work, but it takes some of the code out and leaves me with this inside the index.php file:
<?
= file('http://www.sometime.com/?page=sublist&cat=1');
foreach( as ){
echo ;
}
?>

seems to remove anything with a $ in front of it,
any ideas on how to get around this?

View Replies !
File Writing Issue
I am writing a file using PHP and all is great thus far:

[code....]

However I want to add the facility for the file to be written into a
sub directory that may or may not exist - if the folder exists then it
works fine - if it doesn't then it throws an error.

Without having to write a section of code to check if the folder
exists, is there a way of forcing PHP to build any required folders for
me?

View Replies !
Writing To File Problems
everytime I write to a file, a little black square character is added to the end of the file. I have no idea why this is happening. I'm testing this on my Apache server on Windows XP Home Edition.

View Replies !
PHP Instances Writing To The Same File?
I read in Programming PHP (O'Reilly) that flock() "cannot prevent two
PHP scripts running in the same web server process from accessing a
file at the same time".
In my case a single PHP script appends text strings to an existing text
file. Several clients may trigger the same script on the same web page
and thus more than one PHP instance might try to open and append text
to the same file at the same time. I would assume that using flock()
_does_ in fact prevent simultaneous access in this case. Am I correct?


View Replies !
Writing To A Local File
We have a PHP/MySQL database application. A user would like to be able
to run a routine to read selected data from the database and export a
flat file to their local C: drive. After reviewing the documentation
and posts, it is not clear how to do this, or even if it is allowed by
the browser. If someone could point us in the right direction, we
would greatly appreciate it.

The application is hosted on a Linux server.
The users are required to use Internet Explorer running on Windows 2000
or XP (we also use VBScript).

View Replies !
Writing A Session Value To File
windows xp, apache, php and my sql and dreamweaver mx

I have the code below. And it does'nt work! Basically the code below
is the workings behind the scene that inserts a record to a table and it
gets most of it's value from a form. There's alot more to the code such
as the bindings to text boxes etc but I don't think I need to show you
that, just the basics.

Most of the values come from text box bindings but one of them is a
hidden value $custid Basically a user has logged in prior to the insert
page and then I set a session with their userid. When they then want to
insert a record I don't insert the userid but the customer id ($custid)
and I have a bit of code that supposedly grabs the custid from a
customers table doing a join on the userid.

The insert code below works but it writes back nothing to the custid
field in the table. The code below is a combination of dreamweaver mx
generated code and my hand code.

<?
session_start();
if ($_SESSION[loggedin] != "yes") {
header("Location: http://127.0.0.1/custlogin.php");
exit; }
require_once('Connections/local.php');

// this bit gets the custid from the cutomers table and assigns it to
the variable $thecustid
$thecustid = "SELECT custid FROM customers WHERE userid='" .
$_SESSION['MM_Username'] . "'";

// dreamweaver created all this
function GetSQLValueString($theValue, $theType, $theDefinedValue = "",
$theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) :
$theValue;

switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'"
: "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue :
$theNotDefinedValue;
break;
}

View Replies !

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