Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Feb 2006
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Problem on FILE OPERATOINS ON LINUX O/S( PLZ GIVE REPLY )

    i got a problem when i am creating the file through PHP Program in LINUX O/S Machine..the code is as shown below..
    <?php
    $phpfile="demo_php.php";
    $phpfile=$_SERVER['DOCUMENT_ROOT'].$phpfile;
    $content="ABCDEF";
    $handle=fopen($phpfile,"w")
    /*
    assume phpfile not exist ,the create the file and open that file in the write mode.
    */
    fwrite($handle,$content);

    ?>

    error is : No Permission to create the file....


    i set the permissions 0777 to that folder

  • #2
    Super Moderator
    Join Date
    May 2002
    Location
    Perth Australia
    Posts
    4,093
    Thanks
    11
    Thanked 101 Times in 99 Posts
    You are trying to create.. e.g. /home/usernamedemo_php.php
    e.g. you are missing a slash.
    PHP Code:
    <?php 
    $phpfile 
    $_SERVER['DOCUMENT_ROOT'].'/'.$phpfile;
    ?>
    resistance is...

    MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)

  • #3
    Senior Coder
    Join Date
    Apr 2005
    Location
    Colorado, United States
    Posts
    1,208
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Also, shouldn't the mode be "w+" to create the file if it doesn't exist?
    "$question = ( to() ) ? be() : ~be();"

  • #4
    Super Moderator
    Join Date
    May 2002
    Location
    Perth Australia
    Posts
    4,093
    Thanks
    11
    Thanked 101 Times in 99 Posts
    w+ opens for reading and writing, w is just for write, either should work
    resistance is...

    MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)


  •  

    Posting Permissions

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