Training, Open Source computer languages
PerlPHPPythonMySQLApache / TomcatTclRubyJavaC and C++LinuxCSS 
Search for:
Home Accessibility Courses Diary The Mouth Forum Resources Site Map About Us Contact
Python, Lua and Tcl - public course schedule [here]
Private courses on your site - see [here]
Please ask about maintenance training for Perl, PHP, Java, C, C++, Ruby, MySQL and Linux / Tomcat systems
error message

Posted by bschultz (bschultz), 24 February 2003
I'm getting the following error message on a script.

Warning: main(testphp) [function.main]: failed to create stream: No such file or directory in c:\program files\apache group\apache\htdocs\sports\softball\statstest.php on line 17

Fatal error: main() [function.main]: Failed opening required 'testphp' (include_path='.;c:\php4\pear') in c:\program files\apache group\apache\htdocs\sports\softball\statstest.php on line 17

Here's the code:
require test.php?>

  <?php print$_POST['T1']?>;  size="27"
  <?php print$_POST['T2']?>;" size="13"

     <?php print$_POST['T3']?> size="13"
     <?php print$_POST['T4']?> size="4"
     <?php print$_POST['T5']?> size="4"
     <?php print$_POST['T6']?> size="4"
     <?php print$_POST['T7']?> size="4"
     <?php print$_POST['T8']?> size="4"
     <?php print$_POST['T9']?> size="4"
     <?php print$_POST['T10']?> size="4"
     <?php print$_POST['T11']?> size="4"
     <?php print$_POST['T12']?> size="4"  

Here is code for stats.php:

$filename = 'test.php';
$somecontent = "$_POST[$T1], $_POST[T2], $_POST[T3], $_POST[T4], $_POST[T5]";

// Let's make sure the file exists and is writable first.
if (is_writable($filename)) {

   // In our example we're opening $filename in append mode.
   // The file pointer is at the bottom of the file hence
   // that's where $somecontent will go when we fwrite() it.
   if (!$fp = fopen($filename, 'a')) {
        print "Cannot open file ($filename)";

   // Write $somecontent to our opened file.
   if (!fwrite($fp, $somecontent)) {
       print "Cannot write to file ($filename)";
   print "Success, wrote ($somecontent) to file ($filename)";
} else {
   print "The file $filename is not writable";

Any ideas?

Posted by admin (Graham Ellis), 25 February 2003
Is the first file called "statstest.php" and have you supplied a sample starting at line 17?

I think that
     require test.php
should read
     require "test.php"

Note the extra quotes.  The "." without the quotes is a string concatanation operator, thius making up a file name testphp (note no . in the name) which couldn't be found ....

Posted by bschultz (bschultz), 25 February 2003
That was it, Thanks Graham.

Thanks!  Thought it had to be something simple.


This page is a thread posted to the opentalk forum at and archived here for reference. To jump to the archive index please follow this link.

You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2018: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01225 708225 • FAX: 01225 793803 • EMAIL: • WEB: • SKYPE: wellho