Welcome to the JaguarPC Community
JaguarPC
Sales: (888) 338-5261
Support: (888)-551-3050
Results 1 to 3 of 3

This is a discussion on Can't delete 0777 files !?! in the Shared & Semi-Dedicated forum
[edit] Don't worry, I answered my own question, but I'll leave this as a tip for others: When you create a directlory with php and ...

  1. #1
    Tea is not coffee
    Join Date
    Jan 2002
    Posts
    47

    [SOLVED!] Can't delete 0777 files !?!

    [edit]

    Don't worry, I answered my own question, but I'll leave this as a tip for others:

    When you create a directlory with php and make it 0755, you basically leave yourself out of the permission. Crawl over the directory structure with a CHMOD.


    _______________________________________

    Hi all,

    I have an odd problem. I have written a very useful php script that results in a few files and folders being created. The folders get created with 755 permissions and the files get created (then chmod-ed) with 777 permissions.

    Now I can't delete the files and folders. I've tried over ftp, in the control panel, using a cron job. I even have limited shell access on my account, so I tried rm -r -f directly on the folders, but they won't budge.

    If there are any admins reading this who are curious, the path (on iron) is:

    /home/beatgroo/public_html/makeit/mine3/sect1001.Implement_continuous_improvemen t_systems_and_processes_/page1001.Implement_continuous_improvemen t_systems_and_processes_.php

    I have also (accidently) made some files with \r\n and \r chars in the title -- I don't expect to be able to delete them since I can't reference the files (oops!). [Same path, but "mine1"]

    Is there a way for me to delete such files without a support ticket? (ie. I want to keep using the script since it saves me hours of work.)

    I'm thinking it's the '755' folders that cause the problem, since the "owner" is the php thread, not me. (So what I'm asking is, should there be a way to write a script to chmod each folder?)

    Thanks in advance for any tips!

    Last edited by beatgroover; 07-14-2004 at 08:22 PM.

  2. #2
    Tea is not coffee
    Join Date
    Jan 2002
    Posts
    47

    Talking SOLVED!

    Don't worry, I answered my own question, but I'll leave this as a tip for others:

    When you create a directlory with php and make it 0755, you basically leave yourself out of the permission. Crawl over the directory structure with a CHMOD.

  3. #3
    Community Leader jason's Avatar
    Join Date
    Sep 2001
    Location
    Rochester, NY
    Posts
    6,003
    PHP runs under the Apache process, which is run as nobody, so any files that PHP creates will be owned by nobody. I've never tried it, but people report that you can delete these files if you use CPanel's file manager. Another alternative is to write a php script to unlink() the files.

    If you want to have PHP files owned by you, you can do it by running PHP in CGI mode. Some of the servers will run all CGI scripts under your uid, others require that you put the files in a directory called scgi-bin, so you'll have to experiment a little to see what works for you. To make PHP work as a CGI, use a .cgi extension instead of .php and add

    #!/usr/bin/php

    tothe top of the file so that you end up with something like this:
    PHP Code:
    #!/usr/bin/php
    <?php
        
    ////your code goes here
    ?>
    Finally, to access files that have invisible characters in them (such as new lines and CR's), I believe you can wrap them in double quotes and use the standared escaped characters like \n and \r. So to change the name of such a file use something like:

    mv "./old\nname" ./new_name

    Hope this helps.

    --Jason
    Jason Pitoniak
    Interbrite Communications
    www.interbrite.com www.kodiakskorner.com

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •