Why curl Couldn't resolve host intermittently? - php

I have a web service application that works fine in my local. I have even installed ngrok and I'm able to call it on the public web. But as I put my code on our production server I keep getting the 'Couldn't resolve host' error. I'm using different APIs in my service and intermittently I get this error. (I use apache in my local and nginx on prod)
For example I work with googleapis.com and sometimes it works and sometimes it doesn't on the server. The exact same code works just fine on my local.
It's worth mentioning that I've had this application for few months on this server and it's only this past few days that I've started to get these type of errors.
BTW I've noticed that the Curl version in my local and production and their settings are different but I don't know if that could be the source of the problem because it was working just fine.
I would appreciate any kind of guidance.

Related

Http request refused on Windows environment but not on OSX (mac)

I am working on a React web app with npm for the first time. I'm done with the development and now putting the built package on the web server (bluehost).
All is working well on my Mac: the web app allows getting data from mySQL via php, and posting back to the database.
But when I try the same app (on the same URL, same server, script, same everything...) on my Windows machine, I get an error on the first http request used for authentication.
OPTION http://example.com/script.php net::ERR_CONNECTION_REFUSED
First I thought this was a browser issue.
But I don't get the error on Chrome on my mac but do on Chrome on my Windows, as well as FireFox.
Again, I do not get this error when I test the app on my mac.
Could anybody please give me some direction to solve this?
Thank you!

500 Internal server error on php GET variables (CGI)

I'm currently writing a php API returning a JSON array. On my development environment everything seems to work fine.
So it was time for us to upload it on our dedicated server. But here is the deal. While our code is perfectly working on most environments, it is not on our server.
As I'm not an expert on multi-domain sites, we decided to try cPanel WHM, to easily configure our web server. Everything seems to work well, our API default page is running perfectly, showing the correct responses when a user is not permitted. As we are using custom urls, our .htaccess seems to work as well. But here is the rub! When I'm entering a $_GET variable to enter the API by using the correct keys, the server is automatically responding a 500 internal error.
I tried to look at the apache log file, it shows a
AH02812: attempt to invoke directory as script
I directly understood it was a httpd.conf problem. I replaced ScriptAlias by Alias, as most topics were saying. Now I don't have this error on my log, but its still showing the 500 internal server error.
We are currently running on Debian 7, with the latest stable version of cPanel. Our PHP version is 5.6.

localhost error #500 MAMP

Yesterday I transferred a live WordPress site and successfully setup my local dev environment using MAMP. I was able to get my database exported from my live site and imported locally. I was able to login and see my site, but to my surprise this morning, I am not able to access the site anymore. I am however able to access my localhost, but once I select and enter the root folder I get the always unwelcome "localhost is currently unable to handle this request. error 500".
I am not sure what's happened since yesterday to cause this and I've searched the forums, but I'm at a loss. I am new to local PHP development, so I might be missing something simple. I appreciate any and all help.

configure wamp apache for production environment

I have a web app am developing in-house and testing with wamp and it gives me all the normal results. PHP functions working well, errors reporting and responding when corrected. However, when I moved the site to a remote web hosting service, I get a Server 500 error as the first page tries to load. All the pages that have performed brilliantly in the local wamp setting suddenly reported errors with the same code.
I am wondering if there's something wrong in my wamp setting that makes it behave differently from the remote hosting sites. I have loaded the site on two linux hosting sites now with the same Serve 500 errors.
Please, I need help on how to tune my wamp for standard web operations so that I'd be sure to get the same results I get locally when I run it remotely.
Thanks

NuSOAP - PHP: Having server and client webservice in the same server and domain

I have a client web application (A) who tries to get the information of another application (B) with a webservice.
I've been testing it in my local machine and all went like a charm. However, when I uploaded them to my server (CentOS 6, SELinux disabled, Firewall configuration checked) I get the following error:
wsdl error: Getting http://applicationB/?wsdl - HTTP ERROR: Couldn't open socket connection to server http://applicationB/?wsdl, Error (110): Connection timed out
Of course, "applicationB" is a valid URL.
They are in the same server. One is in appa.domain.com and the other one in appb.domain.com.
I've tried to call directly the IP of the server in stead of writing the domain name, but no luck with that neither.
If I check manually the WSDL URL, I get a well formatted WSDL file, so it's not the problem.
I've tried to connect external webservices and they work well, so I think it's a problem with having the server and client webservices in the same machine (or domain).
With that in mind, I've also tried to listen to port 81 and calling the webservice via this port, so the listening port and the requesting port would not be the same. No luck neither.
I'm stuck with this, and I cannot get more ideas to solve it or to find a workaround.
Anyone of you maybe have experienced this problem before and know how to solve it?
Thanks in advance for your time and answers!
EDIT
I've been trying to connect to my localhost webpage via command line, using Lynx browser from my server and I can't not access the page, even trying with its IP. It cannot be reached.
Maybe this could help to find out a solution.
Finally I got it working...
I post the answer here to be helpful for future users.
The problem was in the hosts server file. As #Amenadiel told me in a comment, it wasn't resolving the names.
I changed the hosts files and it seems it took more than I expected (I made the changes 3 days before and they weren't applied yet) so I discarded the hosts issues as an option. But it seems it was the only problem.
Why, then, didn't work neither when I tried to reach it using its IP? Well, it's because of the server nature. It's a server hosted in the Cloud, so it will be - for sure - a Virtual Machine.
It has a public IP (the one I was pointing to) and a private LAN IP. The server could not see the public IP, so if I was about to use one, it should have been the private (LAN) one.
Thanks again to all of you for your answers and your patience with this server side newbie!

Categories