Announcement

Collapse
No announcement yet.

PHP webserver help

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • PHP webserver help

    Murc to the rescue, hopefully.

    I have created an upload, scale, copy system etc for my site and everything works great when the directories are chmod'd to 777, problem is I have to do this using my ftp program.

    Using chmod("directory", 0777); doesn't work due to permissions, get an operation not allowed error, on checking my server I have noticed that all the directories are owned by 'UsernameHere'.

    Reading around on forums etc it looks like chmod will only work when the directories are owned by 'nobody', how therefore do I go about altering the owner without doing it manually through an ftp client? lots of directories at issue here ~ 1500.

    Can I change anything in my php.ini file (change username somewhere) to fix the issue so that it appears the owner 'me' is running my scripts.

    Server is FreeBSD/Apache
    Go on, someone here must know the answer.


  • #2
    Can you 'chown' the directory? (there is an option -R for recursive chowing)
    (chown = change owner)

    Or perhaps make the directory from within the ftp client..?

    Jörg
    pixar
    Dream as if you'll live forever. Live as if you'll die tomorrow. (James Dean)

    Comment


    • #3
      chown doesn't work either, well not through my php scripts, all works lovely if I chmod manually through cuteftppro

      New directories shouldn't be a problem as when they are created by my code I am assuming that the owner will be nobody.

      Problem is the existing 600 artists (1800 directories) that I have, adding new work means the script has to chmod the directory to 0777, copy the relevant new images in and chmod the dir back. I just get the following error Warning: chmod(): Operation not permitted in /usr/local/www/.......

      Anyone know how on mass through an ftp client like cuteftppro I would I alter the ownership of 1500 directories to 'nobody'.

      Comment


      • #4
        Going to try ftp_chmod($conn_id, 0644, $file)) to see if that works.

        Comment


        • #5
          perhaps ,you need to make sure they are in the right group eg guest or user....etc

          Comment


          • #6
            You can only change ownership or permissions on a dir or file you own

            Going in via the ftp, you are changing the permissions and creating files/dir's using your own login.
            Apache/php is using the 'nobody' or whatever they have called it group. therefor it doesnt have access to the files.

            Easy way - not secure way - around this, is create a parent DIR with 777 and then use the php itself to create directories from there.. it will have ownership of the needed files it creates.
            Juu nin to iro


            English doesn't borrow from other languages. It follows them down dark alleys, knocks them over, and goes through their pockets for loose grammar.

            Comment


            • #7
              That is what is wierd Sasq, according to php I do own them, well if I understand get_current_user(). I have just run get_current_user() in one of my scripts and it returns the same username which I used for FTP access, this username also owns all the folders.

              Running it past my hosts at the moment because before I test ftp_chmod they need to rebuild my php install with ftp support.

              If I login with ftp_chmod() will this solve the ownership issue as I will be logging in with my main ftp details.

              Comment

              Working...
              X