PHP renaming folder problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jOE :D
    Confirmed User
    • Jan 2007
    • 185

    #1

    PHP renaming folder problem

    I'm trying to rename a folder from a php file and it's giving me an error. I'm getting a 'Permission Denied' error, but the folder chmod is 777 so I don't understand why I'm getting this error.
    Need design work or PHP coding? -> Offbeatideas - What's your idea?
    Contact me for all your Predator integration needs!
    ----------------------------------
    My Sites: SpeedySpank (70% ratio - Signup) - Liz Vicious Blog
    AIM: practicetitoism | ICQ: 462598451
  • teksonline
    So Fucking Banned
    • Jan 2005
    • 2904

    #2
    is it outside of the script parent directory?

    Comment

    • dissipate
      The Dirty Frenchman
      • Nov 2005
      • 8904

      #3
      the script doesnt have permissions for the folder, you'll have to chown it to a different owner with the correct delete privileges.

      Comment

      • jOE :D
        Confirmed User
        • Jan 2007
        • 185

        #4
        Originally posted by teksonline
        is it outside of the script parent directory?
        Yes the script is in '/includes/cron' and the folder name I want to change is just in /. I'm using full paths to the folders though.
        Need design work or PHP coding? -> Offbeatideas - What's your idea?
        Contact me for all your Predator integration needs!
        ----------------------------------
        My Sites: SpeedySpank (70% ratio - Signup) - Liz Vicious Blog
        AIM: practicetitoism | ICQ: 462598451

        Comment

        • dissipate
          The Dirty Frenchman
          • Nov 2005
          • 8904

          #5
          It's also sort of disturbing that you advertise PHP coding, and wouldn't know something trivial like file permissions.

          Comment

          • jOE :D
            Confirmed User
            • Jan 2007
            • 185

            #6
            Originally posted by dissipate
            It's also sort of disturbing that you advertise PHP coding, and wouldn't know something trivial like file permissions.
            I understand file permissions. The permissions to the folder are 777 so others should be able to execute stuff on the folder.
            Need design work or PHP coding? -> Offbeatideas - What's your idea?
            Contact me for all your Predator integration needs!
            ----------------------------------
            My Sites: SpeedySpank (70% ratio - Signup) - Liz Vicious Blog
            AIM: practicetitoism | ICQ: 462598451

            Comment

            • teksonline
              So Fucking Banned
              • Jan 2005
              • 2904

              #7
              are you in safe mode?

              Comment

              • dissipate
                The Dirty Frenchman
                • Nov 2005
                • 8904

                #8
                Originally posted by jOE :D
                I understand file permissions. The permissions to the folder are 777 so others should be able to execute stuff on the folder.
                Yes, but there is also an OWNER of the file/folder, you fucking boob. There is a different between chroot and chown. If it's in /includes/cron then it is is most likely owned by the root user. A simple 'ls -l' will show the owner. And your script isnt being executed by the root user unless you're executing it from the command line.

                Comment

                • jOE :D
                  Confirmed User
                  • Jan 2007
                  • 185

                  #9
                  Originally posted by dissipate
                  Yes, but there is also an OWNER of the file/folder, you fucking boob. There is a different between chroot and chown. If it's in /includes/cron then it is is most likely owned by the root user. A simple 'ls -l' will show the owner. And your script isnt being executed by the root user unless you're executing it from the command line.
                  Well then how do I get around that so I can have it executed from the web?
                  Need design work or PHP coding? -> Offbeatideas - What's your idea?
                  Contact me for all your Predator integration needs!
                  ----------------------------------
                  My Sites: SpeedySpank (70% ratio - Signup) - Liz Vicious Blog
                  AIM: practicetitoism | ICQ: 462598451

                  Comment

                  • dissipate
                    The Dirty Frenchman
                    • Nov 2005
                    • 8904

                    #10
                    Originally posted by jOE :D
                    Well then how do I get around that so I can have it executed from the web?
                    http://www.php.net
                    http://www.google.com

                    The interwebz is for porn.

                    Comment

                    • jOE :D
                      Confirmed User
                      • Jan 2007
                      • 185

                      #11
                      Originally posted by dissipate
                      http://www.php.net
                      http://www.google.com

                      The interwebz is for porn.
                      Thanks, I didn't think of those sites before I wasted time posting on a forum. Who would have thought those sites would have helped?
                      Need design work or PHP coding? -> Offbeatideas - What's your idea?
                      Contact me for all your Predator integration needs!
                      ----------------------------------
                      My Sites: SpeedySpank (70% ratio - Signup) - Liz Vicious Blog
                      AIM: practicetitoism | ICQ: 462598451

                      Comment

                      • dissipate
                        The Dirty Frenchman
                        • Nov 2005
                        • 8904

                        #12
                        Originally posted by jOE :D
                        Thanks, I didn't think of those sites before I wasted time posting on a forum. Who would have thought those sites would have helped?
                        Well now that you know what your problem is, maybe they will help. Merry XMAS.

                        Comment

                        • teksonline
                          So Fucking Banned
                          • Jan 2005
                          • 2904

                          #13
                          Who cares who owns it, when its 777 its world writable
                          the problem is php security can not write outside its root in safe mode

                          Comment

                          • dissipate
                            The Dirty Frenchman
                            • Nov 2005
                            • 8904

                            #14
                            Originally posted by teksonline
                            Who cares who owns it, when its 777 its world writable
                            the problem is php security can not write outside its root in safe mode

                            When safe_mode is on, PHP checks to see if the owner of the current script matches the owner of the file to be operated on by a file function or its directory. So yes, the owner of the file matters.

                            Comment

                            • jOE :D
                              Confirmed User
                              • Jan 2007
                              • 185

                              #15
                              Originally posted by dissipate
                              When safe_mode is on, PHP checks to see if the owner of the current script matches the owner of the file to be operated on by a file function or its directory. So yes, the owner of the file matters.
                              Safe mode is off for this domain
                              Need design work or PHP coding? -> Offbeatideas - What's your idea?
                              Contact me for all your Predator integration needs!
                              ----------------------------------
                              My Sites: SpeedySpank (70% ratio - Signup) - Liz Vicious Blog
                              AIM: practicetitoism | ICQ: 462598451

                              Comment

                              • teksonline
                                So Fucking Banned
                                • Jan 2005
                                • 2904

                                #16
                                su_exec? come on man, fill us in on required details and then the answer will present itself

                                Comment

                                • k0nr4d
                                  Confirmed User
                                  • Aug 2006
                                  • 9231

                                  #17
                                  check for openbasedir restrictions? the user that owns it wouldn't matter, as if its chmodded to 0777 it's world writable anyways.

                                  How are you trying to rename it? exec('mv source target') or what?
                                  Mechanical Bunny Media
                                  Mechbunny Tube Script | Mechbunny Webcam Aggregator Script | Custom Web Development

                                  Comment

                                  • teksonline
                                    So Fucking Banned
                                    • Jan 2005
                                    • 2904

                                    #18
                                    I imagine he is unsing rename()
                                    maybe he can't rename it because he is in it?

                                    Comment

                                    • Damian_Maxcash
                                      So Fucking Banned
                                      • Oct 2002
                                      • 12745

                                      #19
                                      I had a similar problem and it was my dumb host.... change it to 755 and try it.

                                      It worked for me and they said it was some security shit that wouldnt let 777 work.

                                      Comment

                                      • etcohen
                                        Registered User
                                        • Jan 2007
                                        • 43

                                        #20
                                        you can try set file privilege for web..

                                        chown www 'filename'

                                        Comment

                                        • Iron Fist
                                          Too lazy to set a custom title
                                          • Dec 2006
                                          • 23400

                                          #21
                                          Originally posted by dissipate
                                          It's also sort of disturbing that you advertise PHP coding, and wouldn't know something trivial like file permissions.
                                          Yikes.
                                          i like waffles

                                          Comment

                                          • teksonline
                                            So Fucking Banned
                                            • Jan 2005
                                            • 2904

                                            #22
                                            Originally posted by Damian_Maxcash
                                            I had a similar problem and it was my dumb host.... change it to 755 and try it.

                                            It worked for me and they said it was some security shit that wouldnt let 777 work.
                                            Uhm, could be some sort of suexec thing which i asked about above, but don't sound right. i could see an error trying to access contents, but not rename..

                                            He isnt providing system info, so no sense wasting brains over this one...

                                            Comment

                                            Working...