473,499 Members | 1,548 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

chmod problems...

Hi NG

If I write the following:

<?php
$file="myfile.JPG";
if ( getmyuid()==fileowner ( $file ) )
{
chgrp ( $file, getmygid() );
chown ( $file, getmyuid() );
chmod ( $file, 0600 );
}
?>

And the result is this:

Warning: chgrp(): Operation not permitted in /.../test/index.php on line
5
Warning: chown(): Operation not permitted in /.../test/index.php on line
6
Warning: chmod(): Operation not permitted in /.../test/index.php on line
7

Does that mean the functions (chgrp, chown, chmod) has been disabled on my
php-deamon? I assume; if I own the file I should be able to change the
rights of the file? It is possible to do this by ftp, but I'd rather do it
by the php-script.
Thanks....

--

Med Venlig Hilsen
Ask Josephsen
Jul 17 '05 #1
6 6663
Try to change your error-reporting value to E_ALL, and look if there is
some more information.
Also look in phpinfo() for disabled functions.

Jul 17 '05 #2
Hi again

My "disable_functions" in the php-core is set to "no value | no value"
(found in phpinfo()). The "Configure Command" is the following:

Configure Command './configure' '--prefix=/usr' '--libdir=/usr/lib'
'--enable-shared' '--disable-static' '--disable-debug' '--disable-rpath'
'--enable-pic' '--enable-inline-optimization' '--with-config-file-path=/etc'
'--enable-magic-quotes' '--enable-debugger' '--enable-track-vars'
'--with-exec-dir=/usr/bin' '--with-versioning' '--with-mod_charset'
'--with-expat-dir=/usr' '--with-regex=php' '--enable-force-cgi-redirect'
'--enable-track-vars' '--enable-trans-sid' '--enable-safe-mode'
'--with-ctype' '--with-ttf' '--with-freetype-dir=/usr' '--with-zlib'
'--enable-sysvsem' '--enable-sysvshm' '--enable-yp' '--enable-ftp'
'--with-gettext' '--without-aspell' '--without-kerberos'

Changing the level of error reporting did not make any change (I placed
"error_reporting(E_ALL);" and "ini_set('error_reporting', E_ALL);" at the
top of the script).

I still get:

Warning: chgrp(): Operation not permitted in /.../test/index.php on line
5
Warning: chown(): Operation not permitted in /.../test/index.php on line
6
Warning: chmod(): Operation not permitted in /.../test/index.php on line
7
:(
Venlig Hilsen

Ask Josephsen
<la******@gmail.com> wrote in message
news:10**********************@f14g2000cwb.googlegr oups.com...
Try to change your error-reporting value to E_ALL, and look if there is
some more information.
Also look in phpinfo() for disabled functions.

Jul 17 '05 #3
Ask Josephsen wrote:
Hi NG

If I write the following:

<?php
$file="myfile.JPG";
if ( getmyuid()==fileowner ( $file ) )
{
chgrp ( $file, getmygid() );
chown ( $file, getmyuid() );
chmod ( $file, 0600 );
}


And the result is this:

Warning: chgrp(): Operation not permitted in /.../test/index.php
on line 5
Warning: chown(): Operation not permitted in /.../test/index.php
on line 6
Warning: chmod(): Operation not permitted in /.../test/index.php
on line 7

Does that mean the functions (chgrp, chown, chmod) has been disabled
on my php-deamon? I assume; if I own the file I should be able to
change the rights of the file? It is possible to do this by ftp, but
I'd rather do it by the php-script.
Thanks....

From the manual for chown ()...
Note: This function will not work on remote files as the file to be
examined must be accessible via the servers filesystem.

Note: When safe mode is enabled, PHP checks whether the files or
directories you are about to operate on have the same UID (owner) as the
script that is being executed.

Does this help ?

KR

Pjotr


Jul 17 '05 #4
Hi

Unfortunately not, the files are placed locally and the current dir is both
owned by the same user id and the permissions are 0777 (read/write/execute
for all).

Thanks though...
Med Venlig Hilsen

Ask Josephsen
"Pjotr Wedersteers" <pj***@wedersteers.com> wrote in message
news:41***********************@news.xs4all.nl...
Ask Josephsen wrote:
Hi NG

If I write the following:

<?php
$file="myfile.JPG";
if ( getmyuid()==fileowner ( $file ) )
{
chgrp ( $file, getmygid() );
chown ( $file, getmyuid() );
chmod ( $file, 0600 );
}


And the result is this:

Warning: chgrp(): Operation not permitted in /.../test/index.php
on line 5
Warning: chown(): Operation not permitted in /.../test/index.php
on line 6
Warning: chmod(): Operation not permitted in /.../test/index.php
on line 7

Does that mean the functions (chgrp, chown, chmod) has been disabled
on my php-deamon? I assume; if I own the file I should be able to
change the rights of the file? It is possible to do this by ftp, but
I'd rather do it by the php-script.
Thanks....

From the manual for chown ()...
Note: This function will not work on remote files as the file to be
examined must be accessible via the servers filesystem.

Note: When safe mode is enabled, PHP checks whether the files or
directories you are about to operate on have the same UID (owner) as the
script that is being executed.

Does this help ?

KR

Pjotr

Jul 17 '05 #5


The following User and Group must be the same on your file as they are
in your httpd.conf file.
User www
Group staff

It also depends on your OS and how it is setup.
For example, you may not be able to change the owner of the file unless
you are root user.

Have you tried changing these permissions from the command line, logged
in as the same user that you webserver is running from?

I hope you are not running this on a external web server.

Derrald

In article <41***********************@news.sunsite.dk>,
"Ask Josephsen" <ask(((at)))minreklame.dk> wrote:
Hi

Unfortunately not, the files are placed locally and the current dir is both
owned by the same user id and the permissions are 0777 (read/write/execute
for all).

Thanks though...
Med Venlig Hilsen

Ask Josephsen
"Pjotr Wedersteers" <pj***@wedersteers.com> wrote in message
news:41***********************@news.xs4all.nl...
Ask Josephsen wrote:
Hi NG

If I write the following:

<?php
$file="myfile.JPG";
if ( getmyuid()==fileowner ( $file ) )
{
chgrp ( $file, getmygid() );
chown ( $file, getmyuid() );
chmod ( $file, 0600 );
}
And the result is this:

Warning: chgrp(): Operation not permitted in /.../test/index.php
on line 5
Warning: chown(): Operation not permitted in /.../test/index.php
on line 6
Warning: chmod(): Operation not permitted in /.../test/index.php
on line 7

Does that mean the functions (chgrp, chown, chmod) has been disabled
on my php-deamon? I assume; if I own the file I should be able to
change the rights of the file? It is possible to do this by ftp, but
I'd rather do it by the php-script.
Thanks....

From the manual for chown ()...
Note: This function will not work on remote files as the file to be
examined must be accessible via the servers filesystem.

Note: When safe mode is enabled, PHP checks whether the files or
directories you are about to operate on have the same UID (owner) as the
script that is being executed.

Does this help ?

KR

Pjotr

--
--
Derrald V
Jul 17 '05 #6
Hi

It is the userpermissions on the server - the php-user is missing the
"write" permissions.

Thanks for your time....
--

Med Venlig Hilsen

Ask Josephsen

"Derrald" <re****************@sbcglobal.not> wrote in message
news:re**************************************@news svr13-ext.news.prodigy.com...


The following User and Group must be the same on your file as they are
in your httpd.conf file.
User www
Group staff

It also depends on your OS and how it is setup.
For example, you may not be able to change the owner of the file unless
you are root user.

Have you tried changing these permissions from the command line, logged
in as the same user that you webserver is running from?

I hope you are not running this on a external web server.

Derrald

In article <41***********************@news.sunsite.dk>,
"Ask Josephsen" <ask(((at)))minreklame.dk> wrote:
Hi

Unfortunately not, the files are placed locally and the current dir is
both
owned by the same user id and the permissions are 0777
(read/write/execute
for all).

Thanks though...
Med Venlig Hilsen

Ask Josephsen
"Pjotr Wedersteers" <pj***@wedersteers.com> wrote in message
news:41***********************@news.xs4all.nl...
> Ask Josephsen wrote:
>> Hi NG
>>
>> If I write the following:
>>
>> <?php
>> $file="myfile.JPG";
>> if ( getmyuid()==fileowner ( $file ) )
>> {
>> chgrp ( $file, getmygid() );
>> chown ( $file, getmyuid() );
>> chmod ( $file, 0600 );
>> }
>>>
>>
>> And the result is this:
>>
>> Warning: chgrp(): Operation not permitted in /.../test/index.php
>> on line 5
>> Warning: chown(): Operation not permitted in /.../test/index.php
>> on line 6
>> Warning: chmod(): Operation not permitted in /.../test/index.php
>> on line 7
>>
>> Does that mean the functions (chgrp, chown, chmod) has been disabled
>> on my php-deamon? I assume; if I own the file I should be able to
>> change the rights of the file? It is possible to do this by ftp, but
>> I'd rather do it by the php-script.
>>
>>
>> Thanks....
> From the manual for chown ()...
> Note: This function will not work on remote files as the file to be
> examined must be accessible via the servers filesystem.
>
> Note: When safe mode is enabled, PHP checks whether the files or
> directories you are about to operate on have the same UID (owner) as
> the
> script that is being executed.
>
> Does this help ?
>
> KR
>
> Pjotr
>
>
>
>

--
--
Derrald V

Jul 17 '05 #7

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

Similar topics

5
16801
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...
1
4682
by: Xuan Yuan | last post by:
I'm using Windows XP Professional and have no FTP installed. Instead, I use Command Promt. I need to CHMOD a PHP file, so I type "CHMOD 775 file-path",but get "'CHMOD'is not recognized as an internal...
4
4794
by: Ian N | last post by:
Hi i'm having a problem with file permissions of upload, they appear to be being set to only readable by the administrator, so anyone browsing the site gets a 403 forbidden error when they try and...
5
9526
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
2902
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...
1
2968
by: James Colannino | last post by:
Ok, so now I have a very interesting problem, this time related to os.chmod. I have the following in a text file: 0600. My script reads that number as a string and converts it to an integer for...
47
3265
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
4743
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
1783
by: softy1 | last post by:
I am having problem in chmod permission settings Here is script <?php $uploaddir = $_POST; $dirsplit = $uploaddir; list($var1, $var2) = explode('/', $dirsplit);...
0
7128
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
7215
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...
1
6892
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
7385
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...
0
4597
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3096
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3088
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1425
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
661
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.