These forums are locked and archived, but all topics have been migrated to the new forum. You can search for this topic on the new forum: Search for 405 Method Not Allowed on the new forum.
I'm getting '405 Method Not Allowed' error and a general '500 internal server error' when the iOS app I'm working on is making an API request to my server with VirtualMIn installed.
http://api.fillesmag.com/confirmpurchase/com.prismstudios.fillesmagazine...
Is this a server configuration error? Maybe something to do with security?
If so, how do I fix this?
Howdy,
What errors do you see in the Apache error logs when that occurs?
Those are available in $HOME/logs/error_log.
-Eric
I've looked in several logs, but I think you're talking about the log in "Logs and Reports > Apache Error Log".
Unfortunately, I haven't seen any errors showing up in the logs. Only client side.
I tried using Charles Proxy to further debug, but haven't been able to pinpoint the error:
https://www.dropbox.com/s/ydygkde6q1jiaym/Charles_overview.png
https://www.dropbox.com/s/wbn1jruium322h0/Charles_request.png
https://www.dropbox.com/s/thanen85i9nddk7/Charles_Response.png
From what I've researched, a 405 error is a server configuration error. Is this true?
The full message reads like so: "HTTP method not allowed for the requested resource. Use one of these instead: POST"
This sounds like a problem with the web software that's handling the request. You might want to review your code.
Also, it's somewhat unlikely that a 500 error does not log anything into the Apache log. At least in the access log you should see the error and URL requested. If nothing gets logged to the Apache error log, it might be an issue with the web software too when it doesn't output any PHP errors or similar. I don't think this is an Apache issue.
Your right, I'm an idiot. I was looking at the logs in the top level domain instead of api.fillesmag.com. However, from my own research (I may be wrong) the 500 internal server error and the 405 error can mean several things. I haven't ruled out the web software since it hasn't been tested with a server running VirtualMin, but it is powering several production apps.
Here is the error from the apache error log from this sub-server:
Here's the block of code at line 851:
Should there be cgi-bin in this folder? I've also come across that this error can be cgi files that aren't properly configured or in the correct folder.
This is from the access log:
These are the errors from the /var/log/apache2/error.log:
The key error would seem to be this:
[Mon Apr 07 17:29:18 2014] [warn] [client 66.25.153.86] mod_fcgid: stderr: PHP Fatal error: Call to undefined function curl_init() in /home/fillesmag/domains/api.fillesmag.com/public_html/index.php on line 851
Do you have the CURL extension active in PHP? You can verify that in the PHP ini file/editor of the domain in question.
Googling for the error message usually helps. ;)
http://stackoverflow.com/questions/6382539/call-to-undefined-function-cu...
Howdy,
One of the errors in your Apache logs was the following:
Call to undefined function curl_init()
That can occur if the PHP Curl module isn't installed/enabled.
Is the PHP Curl package installed on your system?
-Eric
Yes, that was it. My main problem for the last couple of days was that I was looking for errors in the top level domain and not the sub domain.
My server is an Ubuntu 12.04.4
I fixed the issue by installing the PHP curl extension:
Then in /etc/php5/apache2/php.ini in the Dynamic Extensions block I added this one line:
Then rebooted the server:
I solved it. My main problem for the last couple of days was that I was looking for errors in the top level domain and not the sub domain i.e api.fillesmag.com
Also, I'm managing my own server. It may be that managed servers install this extension by default? My server is an Ubuntu 12.04.4
I fixed the issue by installing the PHP curl extension:
Then in /etc/php5/apache2/php.ini in the Dynamic Extensions block I added this one line:
Then rebooted the server:
Now everything is working as it should.
You wouldn't even have needed to reboot the server, an Apache restart would have sufficed. :) Just so you know for the next time you need to activate a PHP extension.