Find the answer to your Linux question:
Results 1 to 2 of 2
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    creating file with php

    hi,i am learning php with fedora core 4, i wrote the code
    ************************************************** *****
    $ourFileName = "testFile.txt";
    $ourFileHandle = fopen($ourFileName, 'w') or die("can't open file");
    ************************************************** *****
    in my /var/www/html/firstphp.php, and opened it with my browser http://localhost/firstphp.php
    and it says "can't open file", however, if the file never existed, it would now be created, quoted by

    " The file "testFile.txt" should be created in the same directory where this PHP code resides. PHP will see that "testFile.txt" does not exist and will create it after running this code. "

    there is nothing called testFile.txt in my /var/www/html

  2. #2
    Linux User mactabilis's Avatar
    Join Date
    Apr 2005
    Did you put the open and close tags in,


Posting Permissions

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