Bluehost.com Web Hosting $6.95

chmod problems...

This is a discussion on chmod problems... within the PHP Language forums, part of the PHP Programming Forums category; Hi NG If I write the following: <?php $file="myfile.JPG"; if ( getmyuid()==fileowner ( $file ) ) { chgrp ( $file, ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 10-24-2004
Ask Josephsen
 
Posts: n/a
Default 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


Reply With Quote
  #2 (permalink)  
Old 10-24-2004
lambroso@gmail.com
 
Posts: n/a
Default Re: chmod problems...

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.

Reply With Quote
  #3 (permalink)  
Old 10-24-2004
Ask Josephsen
 
Posts: n/a
Default Re: chmod problems...

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


<lambroso@gmail.com> wrote in message
news:1098621371.530166.137980@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.
>



Reply With Quote
  #4 (permalink)  
Old 10-24-2004
Pjotr Wedersteers
 
Posts: n/a
Default Re: chmod problems...

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




Reply With Quote
  #5 (permalink)  
Old 10-24-2004
Ask Josephsen
 
Posts: n/a
Default Re: chmod problems...

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" <pjotr@wedersteers.com> wrote in message
news:417be78b$0$78753$e4fe514c@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
>
>
>
>



Reply With Quote
  #6 (permalink)  
Old 10-25-2004
Derrald
 
Posts: n/a
Default Re: chmod problems...



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 <417c0a0e$0$77011$14726298@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" <pjotr@wedersteers.com> wrote in message
> news:417be78b$0$78753$e4fe514c@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
Reply With Quote
  #7 (permalink)  
Old 10-25-2004
Ask Josephsen
 
Posts: n/a
Default Re: chmod problems...

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" <remove_me_dman_ppy@sbcglobal.not> wrote in message
news:remove_me_dman_ppy-BA549F.19025024102004@newssvr13-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 <417c0a0e$0$77011$14726298@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" <pjotr@wedersteers.com> wrote in message
>> news:417be78b$0$78753$e4fe514c@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



Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 06:01 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0