prg1 Posted August 28, 2010 Share Posted August 28, 2010 Hi all messing about with php , trying to get my head round the basics : ok I have a file called test.php with this in it <? $ourFileName = "testFile.txt"; $ourFileHandle = fopen($ourFileName, 'w') or die("can't open file"); fclose($ourFileHandle); ?> when I run this instead of creating a blank text file called testfile.txt all it does is repeat the code in the command box window as below C:\php>php -f c:\php\test\test.php <? $ourFileName = "testFile.txt"; $ourFileHandle = fopen($ourFileName, 'w') or die("can't open file"); fclose($ourFileHandle); ?> C:\php> Anyone got a clue as to why it wouldnt create a text file please? Quote Link to comment Share on other sites More sharing options...
Rifts Posted August 28, 2010 Share Posted August 28, 2010 you cant run php in command promt. you need to install a local server and run the files through your browser. download and install this is has everything you need http://www.wampserver.com/en/ Quote Link to comment Share on other sites More sharing options...
fortnox007 Posted August 29, 2010 Share Posted August 29, 2010 <? $ourFileName = "testFile.txt"; $ourFileHandle = fopen($ourFileName, 'w') or die("can't open file"); fclose($ourFileHandle); ?> Maybe also try to start your php with <?php and end with ?> <? as opening tag is considered a bad thing ; ) Quote Link to comment Share on other sites More sharing options...
prg1 Posted August 29, 2010 Author Share Posted August 29, 2010 Many thanks for that , did the trick Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.