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, ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
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 |
|
|||
|
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. > |
|
|||
|
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 |
|
|||
|
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 > > > > |
|
|||
|
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 |
|
|||
|
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 |