• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
500 error from call to XMLHttpRequest()

#1
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?
Reply

#2
(09-14-2018, 09: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
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)?
Reply

#4
(09-15-2018, 02: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
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.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2018 MyBB Group.