Whenever I start a session before I call file_get_contents PHP crashes. It is not able to connect to any other site.

I am not able to use fsockopen to connect to my smtp either.

Using fsockopen to connect to smtp gives me:
Warning: fsockopen(): unable to connect to localhost:25

When running the example below I get the results both when I include the session_start AND not. But when including start_session the server uses 30 to 60 seconds to open the page. (When no session_start it uses 1 second)

Not including session_start() in the top of the examples makes the functions work.

My example for file_get_contents looks like this:

<?php
session_start();
$strContent = file_get_contents('http://www.vg.no');

?>

    Works fine here, even from the CLI. What do the server's logs say? What if you add:

    error_reporting(E_ALL);

    ??

      I added error_reporting(E_ALL); on top of the files.

      I created two examples now.

      This one is with the session_start();
      http://demo.siteman.no/sleipnir.php
      This never finishes loading.

      This one withouth session_start();
      http://demo.siteman.no/sleipnir_nosess.php
      This return a blank screen, and writes content read to a file.

      My phpinfo: http://demo.siteman.no/phpinfo.txt , this is in cli mode since I can not run phpinfo because it just hangs.

      My example file:

      <?php
      error_reporting(E_ALL);

      session_start();
      $strContent = file_get_contents('http://www.vg.no');
      $fh = fopen ('test_foo.txt', 'w');
      fputs ($fh, $strContent);
      fclose($fh);
      ?>

      I am running apache 2 and php 4.3.4 (on SLES 9)

        Write a Reply...