SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    Confirmed Halfwit
    Join Date
    Oct 1999
    Location
    Vancouver, BC, Canada
    Posts
    983
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Does anyone know if it is possible to set the file permission for a file opened for writing using "fopen"?

    Here's my code:
    Code:
    $fp = fopen("/home3/gridops/temp/henri.txt", "w"); 
    	if (!$fp) { 
    		echo "Error opening the temp file!"; 
    		}
    	else {
    		fwrite($fp, "henri was here!"); 
    		fclose($fp);
    		echo "File was written!";
    		}
    The problem is that this code only works when I am in NON-SSL mode.. when I use SSL (HTTPS), it gives me a permission problem when creating the file... so I figure I need to chmod the henri.txt file to 666 or something.. but how do I do this with fopen? Is there an alternate mechanism to do it?

    Thanks.

    BTW - how do you get your php code samples to be colorful when posting?
    - A simple online WYSIWYG editor for HTML code snippets.
    - Managed Web Hosting - $3.95/month (resellers welcome)
    - Why pay more? $8.95 domains & $9.95 SSL certificates!

  2. #2
    SitePoint Zealot cokeman's Avatar
    Join Date
    Dec 2000
    Location
    So. California
    Posts
    173
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't think fopen can do that.. I would use chmod()

    To get the color in php code, you can use [php] and [ /php] tags in your post.. (I have a space in the /php tag so that it won't get parsed

  3. #3
    Confirmed Halfwit
    Join Date
    Oct 1999
    Location
    Vancouver, BC, Canada
    Posts
    983
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks cokeman.

    I was hoping I wouldn't have to add a bunch of extra commands to my script.. (one to create the file, one to chmod it, and then finally the fopen to write to it..).. but I guess that's just too bad, eh?

    Thanks for your help with the [php] [ /php] tags.. I didn't see those in the Quick Help section next to the reply text box.. maybe I didn't look hard enough?
    - A simple online WYSIWYG editor for HTML code snippets.
    - Managed Web Hosting - $3.95/month (resellers welcome)
    - Why pay more? $8.95 domains & $9.95 SSL certificates!


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
  •