matleeds Posted August 25, 2011 Share Posted August 25, 2011 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, Quote Link to comment https://forums.phpfreaks.com/topic/245675-php-or-apache-failed-to-open-stream-error/ Share on other sites More sharing options...
Muddy_Funster Posted August 25, 2011 Share Posted August 25, 2011 Does PHP have explicit read permissions on that folder/file? Have you dissabled UAC in Vista? Quote Link to comment https://forums.phpfreaks.com/topic/245675-php-or-apache-failed-to-open-stream-error/#findComment-1261800 Share on other sites More sharing options...
matleeds Posted August 25, 2011 Author Share Posted August 25, 2011 Hi, thanks for the speedy response. How would I check either of those two questions? Quote Link to comment https://forums.phpfreaks.com/topic/245675-php-or-apache-failed-to-open-stream-error/#findComment-1261802 Share on other sites More sharing options...
Muddy_Funster Posted August 25, 2011 Share Posted August 25, 2011 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. Quote Link to comment https://forums.phpfreaks.com/topic/245675-php-or-apache-failed-to-open-stream-error/#findComment-1261812 Share on other sites More sharing options...
matleeds Posted August 25, 2011 Author Share Posted August 25, 2011 Hi, I've tried both those and still get the same problem I'm afraid. Quote Link to comment https://forums.phpfreaks.com/topic/245675-php-or-apache-failed-to-open-stream-error/#findComment-1261819 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.