By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,965 Members | 1,757 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,965 IT Pros & Developers. It's quick & easy.

chmod problems...

P: n/a
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
Share this Question
Share on Google+
6 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a


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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.