Jump to content

PHP or Apache - Failed to open stream error


matleeds

Recommended Posts

Hi there,

 

I'm a .net developer and I've inherited a partially complete php project. I'm trying get part of it running on my pc and am running into some issues due to my fairly limited knowledge with php/apache web server.

 

I'm using Windows Vista, I have Apache HTTP server 2.2 running and am using PHP 5.2.17.

 

The aim is to send some data to the web server.

 

I'm using this function below -

 

public static function push_data($data)

{

$data = base64_encode(gzdeflate(ot::encrypt(serialize($data), otCRYPT_KEY), 9));

$data = http_build_query(array(otDATA_KEY => $data));

$opts = array (

'http' => array (

'method' => 'POST',

'header'=> "Content-type: application/x-www-form-urlencoded\r\n"

. "Content-Length: " . strlen($data) . "\r\n",

'content' => $data

)

);

$ctx = stream_context_create($opts);

return file_get_contents(otDATA_URL, 0, $ctx);

}

 

And am getting this message back -

 

PHP Warning: file_get_contents(http://localhost/Epointment/ot/backend/data.php): failed to open stream: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host failed to respond.

 

I've echoed $ctx and get Resource ID #15

and echoed otDATA_URL and get http://localhost/Epointment/ot/backend/data.php, which is correct.

 

I've run a test php script actually on the web server and it works, so at least I know the server is running

and PHP works on it.

 

I'm not sure if this is an issue with the Apache settings or the PHP script or php.ini settings

 

thanks for any help,

 

Link to comment
Share on other sites

UAC is that annoying "Are you the one who wanted this to happer" message that was introduced with Vista and can be modified with the control panel -> users settings.  Folder/file permissions can be checked by bringing up the security tab of the folder/file properties.  As you havn't set Apachi or PHP users I would recomand that you make sure that the security settings include "Everyone" and set it "Read & Execute" if you are in a network environment or if you are in a trusted location "Full Control" would make absoloutly certain.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.