chmod problems...

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ask Josephsen

    #1

    chmod problems...

    Hi NG

    If I write the following:

    <?php
    $file="myfile.J PG";
    if ( getmyuid()==fil eowner ( $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


  • lambroso@gmail.com

    #2
    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.

    Comment

    • Ask Josephsen

      #3
      Re: chmod problems...

      Hi again

      My "disable_functi ons" 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_reportin g(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.goo glegroups.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]


      Comment

      • Pjotr Wedersteers

        #4
        Re: chmod problems...

        Ask Josephsen wrote:[color=blue]
        > Hi NG
        >
        > If I write the following:
        >
        > <?php
        > $file="myfile.J PG";
        > if ( getmyuid()==fil eowner ( $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




        Comment

        • Ask Josephsen

          #5
          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@wederste ers.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.J PG";
          >> if ( getmyuid()==fil eowner ( $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]


          Comment

          • Derrald

            #6
            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$770 11$14726298@new s.sunsite.dk>,
            "Ask Josephsen" <ask(((at)))min reklame.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@wederste ers.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.J PG";
            > >> if ( getmyuid()==fil eowner ( $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

            Comment

            • Ask Josephsen

              #7
              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.19025024 102004@newssvr1 3-ext.news.prodig y.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$770 11$14726298@new s.sunsite.dk>,
              > "Ask Josephsen" <ask(((at)))min reklame.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@wederste ers.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.J PG";
              >> >> if ( getmyuid()==fil eowner ( $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]


              Comment

              Working...