My project uses PHP JavaBridge, I have installed WAMP, JRE 6.0, and Tomcat 6.0.32
I can now access http://localhost:8080/ successfully but when I run my PHP site it gives me the following error
warning: fsockopen() [function.fsockopen]: unable to connect to localhost:8080 (A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. )
Can anyone please help me with this issue?
EDIT
Forgot to mention that I am using Windows 7
My comment above worked as a solution and hence this answer, so that in future others get it.
Can you 127.0.0.1:8080 instead of localhost:8080? See what do you get?
fsocketopen takes the hostname and it should be a valid domain, in your case, (in general) it could be a valid domain as long as you have an entry for localhost in your hosts file (C:\Windows\System 32\drivers\etc\hosts). See if you have something similar to that.
Related
When I try to run a PHP website with Laragon I get This site can’t provide a secure connection localhost sent an invalid response. Try running Windows Network Diagnostics. ERR_SSL_PROTOCOL_ERROR
I already changed the hostname template within Laragon to {name}.local and {name}.mc but didn't worked.
What should I do? (Other PHP built websites are still working)
I right clicked on Apache in Laragon, turned SSL on and now it works.
I am trying to connect to a remote mysql server, but I get the
Warning: mysqli_connect(): (HY000/2002): A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
This connection worked until a few days back, but I suspect an antivirus update changed the permissions for the port. I am unable to figure it out and it's already frustrating.
I am using XAMPP, which I already reinstalled. I have also tried in WAMP, so it is not local webserver related.
Telnet fails when opening connection to host, my IP is allowed on the remote server.
I have also disabled the antivirus and firewall temporarily, but still fail to connect. What else should I try?
First check no other application is using the port. Because of the problem MySQL can't start at the port . check it and is not work means reinstall the xampp with another place like D: , E: , something else.
When I connect to the network using the local network connection I am unable to establish a connection to my server. It returns the following error:
Warning: mysqli::mysqli(): (HY000/2002): A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. in C:\xxxx\htdocs\xxxx.xxxx\class\class.mysql.php on line 11
Connect Error (2002) A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
Warning: mysqli::close(): Couldn't fetch mysql in C:\xxxx\htdocs\xxxx.xxxx\class\class.mysql.php on line 59
Now when I tether through my phone I have no problems connecting to the server.
My knowledge of networking is extremely ignorant so do forgive me if this is obvious, but what could some of the issues be stopping my connection to the server?
I have figured out the answer to the problem I was experiencing. I am documenting below, just in case it helps anyone else.
=========================
I recently came across a problem when working through the 4th edition of Kevin Yank's "Build Your Own Data-Driven Website."
There appears to be an incompatibility between certain software packages and operating systems. In particular, this affects PHP 5.3 when trying to connect to MySQL while running on Windows Vista with Apache. It is not really a bug, but a discrepancy between how far along the different elements are in the transition from IPv4 to IPv6.
Basically, when PHP tries to connect to the database, it times out because it does not recognize localhost, only 127.0.0.1, and produces the following error message:
=========================
Warning: mysqli_connect() [function.mysqli-connect]: [2002] A connection attempt failed because the connected party did not (trying to connect via tcp://localhost:3306) in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\phpmysql-4\chapter4\connect\index.php on line 2
Warning: mysqli_connect() [function.mysqli-connect]: (HY000/2002): A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\phpmysql-4\chapter4\connect\index.php on line 2
Fatal error: Maximum execution time of 30 seconds exceeded in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\phpmysql-4\chapter4\connect\index.php on line 2
=========================
There are two possible solutions to this problem:
=========================
Replace "localhost" with "127.0.0.1" in all PHP files that you wish to have connect to a MySQL database
Locate the "hosts" file on your computer. It is typically at a location such as this:
C:\Windows\System32\drivers\etc\hosts
Open it up, and comment out the line that prevents the localhost from "mapping" correctly; in otherwords, change
::1 localhost
to
::1 localhost
This solution was, in fact, presented in the SitePoint forums previously, though without a full explanation of the details.
http://www.sitepoint.com/forums/showthread.php?t=637612
=========================
The issue is described in detail on the PHP forum at the following link:
http://bugs.php.net/bug.php?id=45150
Please note that -- from what I understand -- Windows XP does not have this problem, as it is configured only to IPv4. Vista runs into a problem because it is designed to handle both, as is Windows 7.
Also, I should mention that using PHP 5.2 with the aforementioned book is not recommended because there is a bug in that version -- a veritable one -- that causes Apache to crash when it attempts to open the "deletejoke" file.
I recently downloaded and installed "PHP for Android." I created a .php file that utilizes an SSL connection with port 2195. I followed a guide for writing a php server that sends push notifications to Apple's APNS, and SUCCESSfully ran it on my Mac. When I put both the .php and the .pem onto my Android phone in the same folder and tried to run it with the same WIFI connection, I get the following error message:
Error:14094410:SSL routines:func(148):reason(1040) in /mnt/sdcard/sl4a/scripts/lot.php on line 19
Warning: stream_socket_client(): Failed to enable crypto in /mnt/sdcard/sl4a/scripts/lot.php on line 19
Warning: stream_socket_client(): unable to connect to ssl://gateway.sandbox.push.apple.com:2195 (Unknown error) in /mnt/sdcard/sl4a/scripts/lot.php on line 19
Does anyone have any ideas of how I can fix this?
THANKS!
I had the SSL error on my Windows desktop, with a PHP script that accessed a HTTPS resource.
The solution was to enable the openssl extension. So maybe it's the same kind of problem you have here, something related to opensll on Php for Android.
I'm not sure how to fix it, but Google has it's own push notification framework. There is an example here: http://code.google.com/android/c2dm/
Edit to Answer:
I think that most likely the problem has to do with the certificates needed to make the call over SSL. It is possible that the PHP for Android app does not have permissions to access security certificates you need.
I'm running Windows, having installed IIS 7.5, PHP 5.3 (FastCGI). Trying to connect to MySQL and getting an error "A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.".
Started to develop a project with XAMPP, but had the requirement to move it to IIS (because of AD auth). MySQL is running from XAMPP stack. I've mapped IIS to the same docroot as Apache2's, but to another port. When accessing test page server with Apache2 host - there is no problem, but when accessing IIS + PHP FCGI page - I get this error.
will the standalone installation of MySQL help?
what are your advises?
In your script, try using "127.0.0.1" instead of "localhost" as MySQL host.
If this solves your problem you can add the following line to your hosts file in /Windows/System32/drivers/etc/hosts:
127.0.0.1 localhost
After that you will able to use "localhost".
try using "127.0.0.1" instead of "localhost" as MySQL host.
Just saved my life XD XD XD