Welcome Guest, Not a member yet? Register   Sign In
500 error from call to XMLHttpRequest()
#1

(This post was last modified: 09-14-2018, 08:14 PM by richb201.)

I am getting a 500 error on the Linux version of my code. The version on my WAMP under windows doesn't have this issue. The LAMP version is a Bitnami  instance running on AWS. I took a look in the error.log and I see:

malformed header from script 'index.php': Bad header: {"0":["{choose}","IOS","Mac","
and 
AH01070: Error parsing script headers

I see that AH01070 is an Apache bug. I am running on AWS LightSail. 

 This is where I set my headers in my CI code:

$this->output
   ->set_content_type('application/json')
   ->set_header("Access-Control-Allow-Origin", "*")
   ->set_output(json_encode($table));


Any ideas? Do I need to move back to Windows?
proof that an old dog can learn new tricks
Reply
#2

(09-14-2018, 08:11 PM)Hrichb201 Wrote: ...

Any ideas? Do I need to move back to Windows?

You should start developing on an environment that matches the production environment as much as possible.
Reply
#3

(This post was last modified: 09-15-2018, 02:40 AM by richb201.)

valid point. My problem might be a need to set a Content-Length in the header. 

I added:

->set_header("Content-Length: 1000")

And it still gives me a 500 error, but at least the error in the error log went away. How do I get the actual length of a json encoded structure (instead of 1000)?
proof that an old dog can learn new tricks
Reply
#4

(09-15-2018, 01:58 AM)richb201 Wrote: valid point. My problem might be a need to set a Content-Length in the header. 

I added:

->set_header("Content-Length: 1000")

And it still gives me a 500 error, but at least the error in the error log went away. How do I get the actual length of a json encoded structure (instead of 1000)?

strlen(json_encode($table));
??
Reply
#5

(This post was last modified: 09-16-2018, 07:56 AM by richb201.)

Could the issue be that the windows server (that works) is https while the Linux is http? Other than that, the php.ini is clearly different, too.
proof that an old dog can learn new tricks
Reply




Theme © iAndrew 2016 - Forum software by © MyBB