473,407 Members | 2,306 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

chmod doesn't work?

hi all,

I have a file (mode 644) I want to change to mode 777.
The code:
if (file_exists($this->mailAliasFile))
{
echo "file exists<br>";
if (chmod ($this->mailAliasFile, 0777))
echo "OK<br>";
else
echo "not OK<br>";
}

Returns:
file exists
NOT OK

The file is stored on a linux server. Someone knows how I can obtain the rights to modify it?

regards
Stijn
Jul 17 '05 #1
2 3135
In message <40***********************@news.skynet.be>, stijn goris
<me*****@hotmail.com> writes
hi all,
*
I have a file (mode 644) I want to change to mode 777.
The code:
if (file_exists($this->mailAliasFile))
{
*echo "file exists<br>";
*if (chmod ($this->mailAliasFile, 0777))
* echo "OK<br>";
*else
* echo "not OK<br>";
}
*
Returns:
file exists
NOT OK
*
The file is stored on a linux server. Someone knows how I can obtain the
rights to modify it?
You gotta own the file or be root to do things like this. It's a Unix /
Linux thing not a PHP thing - PHP is just following the rules of Unix /
Linux.
*
regards
Stijn


--
Five Cats
Email to: cats_spam at uk2 dot net
Jul 17 '05 #2
snip>>
You gotta own the file or be root to do things like this. It's a Unix /
Linux thing not a PHP thing - PHP is just following the rules of Unix /
Linux.


Sound like he wants to do it via his script which I assume would be
the user that the server runs under. Apache maybe?

In *.nix environments, the application 'httpd' (Apache) runs with some
user credentials - usually 'nobody', 'apache' or something similar.
You need to set the permissions so that the user 'nobody' (or 'apache'
or whatever user the httpd process is running under) will be allowed
to read them.

My "/etc/httpd/conf/httpd.conf" file, on line 251 lists:

User Apache
Group Apache

Don't change those, change the files permissions.
maybe chmod 755 /file/in/question depending on your security needs.

Man chmod

Man chown

http://httpd.apache.org/docs-project/
Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Daniel | last post by:
Hi, From what I read from the PHP manual, chmod on a Windows platform should have no effect, and that seems totally normal (unless someone on sourceforge has a windows port of that!). I...
6
by: Ask Josephsen | last post by:
Hi NG If I write the following: <?php $file="myfile.JPG"; if ( getmyuid()==fileowner ( $file ) ) { chgrp ( $file, getmygid() ); chown ( $file, getmyuid() );
1
by: Michael Lubavin | last post by:
Hi, I am having a perl cgi script that needs to be able to create and write a new file. Is there a way I can use chmod within the script to give temporary world access to my directory, and then...
5
by: Stewart | last post by:
Hi, I'm working on a program in VC++ right now that needs to set file permissions of a given file to 766 (read/write/execute). Now I've found the _chmod() function in the API help docs, but that...
2
by: Joseph S. | last post by:
Hi all, Consider this case: I have a free php hosting account (a LAMP host) with an account name (also the name of my directory) 'sample'. Under 'sample', I have php scripts which can create...
2
by: Freebird | last post by:
Hello everyone, =] I need your help, I'm creating a script that will work in many servers, and there's this part, where you can update a list, so the script goes from the client's machine to...
47
by: frizzle | last post by:
Hi, I am at the base of an FTP thingy i'm building, and i noticed that it would only work if i chmod the folder 777, i thought to remember correctly that previously on another site chmod 744 was...
3
by: Rik | last post by:
Hello, first of all, my provider sucks, newsserver is down for the #nth time now, offcourse when I have an urgent question.... So this will be me first time using Google Groups, forgive me if...
1
by: lawrence k | last post by:
I've a simple script to transfer some files from one domain to another, with both domains living on the same server. The files in both directories are already chmod 777. Yet after transfer, I try...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.