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 | | | | 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. | | | | 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...[color=blue]
> 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.
>[/color] | | | | re: chmod problems...
Ask Josephsen wrote:[color=blue]
> Hi NG
>
> If I write the following:
>
> <?php
> $file="myfile.JPG";
> if ( getmyuid()==fileowner ( $file ) )
> {
> chgrp ( $file, getmygid() );
> chown ( $file, getmyuid() );
> chmod ( $file, 0600 );
> }[color=green]
>>[/color]
>
> 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....[/color]
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 | | | | 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...[color=blue]
> Ask Josephsen wrote:[color=green]
>> Hi NG
>>
>> If I write the following:
>>
>> <?php
>> $file="myfile.JPG";
>> if ( getmyuid()==fileowner ( $file ) )
>> {
>> chgrp ( $file, getmygid() );
>> chown ( $file, getmyuid() );
>> chmod ( $file, 0600 );
>> }[color=darkred]
>>>[/color]
>>
>> 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....[/color]
> 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
>
>
>
>[/color] | | | | 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:
[color=blue]
> 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...[color=green]
> > Ask Josephsen wrote:[color=darkred]
> >> 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....[/color]
> > 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
> >
> >
> >
> >[/color][/color]
--
--
Derrald V | | | | 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...[color=blue]
>
>
> 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:
>[color=green]
>> 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...[color=darkred]
>> > 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
>> >
>> >
>> >
>> >[/color][/color]
> --
> --
> Derrald V[/color] |  | | | | /bytes/about
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 226,501 network members.
|