Home > Uncategorized > Premature end of script headers

Premature end of script headers

I’m not really used to fixing problems on Linux / Apache – but after a server crash, and a forced migration to a new server, I’ve had to get my hands dirty and try and get a new Linux server back up and running.

So, my problem was. I needed to install Perl, Python and Ruby on the server, I had existing scripts but nothing appeared to work, I just got the generic Http 500 Internal server error message. – Which isn’t enough to work with.

The first step with troubleshooting is to get more information on the error, which means in my case anyway, looking at the file /var/log/httpd/error_log (I’m on centOS), and looking at the last error.

Then fixing the error listed

Permission denied: exec of ‘….HelloWorld.py’ failed

This means you need to grant execute permissions to the file, – i.e. in WinSCP, right click the file, select properties, then click all the X checkboxes in permissions

Premature end of script headers: HelloWorld.py

This means, in my case anyway, was the shebang line was pointing to the wrong file – so instead of

#!usr/local/bin/python it was in fact #!usr/bin/python

You can type which python into the command prompt to find the location of your python executable

: undefined method `require_relative’ for main:Object

This was a ruby specific error I got, which was because I had an old version of Ruby installed (1.8.1), just replaced require_relative to require, and that went away.

Advertisement
Categories: Uncategorized
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: