0

Smashed my head against an issue i have with php fopen(). It works on my test server, but doesn't on my production. I have CentOS 7 on production.

<?php
        ini_set('display_errors', 'On');
        error_reporting(E_ALL);

        echo "starting\n";
        $fh = fopen("/tmp/testwrite", "w") or die("can't open file for writing");

        $bytes = fwrite($fh, "test line") or die("can't write");
        echo "$bytes are written to " . realpath("/tmp/testwrite");

        sleep(1);

        fclose($fh) or die("can't close");
        echo "file closed";

No error is thrown, all lines are in the output, but no file is created in /tmp folder on a server.

Any ideas? Thank you

Philipp Grigoryev
  • 1,985
  • 3
  • 17
  • 23
  • @kmlnvm Sorry, but that is complete nonsense. The `/tmp` directory specifically exists to save temporary files for any process. – arkascha Mar 21 '15 at 20:22
  • Sounds like your php process is locked inside a change root environment or similar. – arkascha Mar 21 '15 at 20:24
  • You might [this question](http://stackoverflow.com/questions/8018693/get-meaningful-information-when-fopen-fails-php-suphp) useful – Michael Doye Mar 21 '15 at 20:38

0 Answers0