Web pages not displaying correctly/500 internal se

Have just setup 3 web domains and have set up within Virtualmin.

When I type in an address it displays correctly, well 1 does. Am awaiting a response from my ISP about the other 2. So not to bothered about them.

The one that displays is http://www.letmemindyourchild.co.uk

The problem is when I am trying to install some scripts. Gallery, wordpress etc, I am not able to go to the web address quoted at the end to complete the installation. Comes up with 500 internal server error.

Any ideas as were to start to look for a solution?

I have heard and read that these 500 errors are a nightmare to resolve. Just my luck. I am wondering if this is a php problem.

Have looked in the apache error log and the only error that is displayed is:
Premature end of script headers: index.php

Does this even when accessing via localhost to, if that makes any difference.<br><br>Post edited by: Berilac, at: 2008/08/25 09:21

Howdy,

Two questions for you:

  1. Is there any other errors related to the problem in the error_log, or is the "premature end of script headers" the only thing you see?

  2. During the installation of the apps, Virtualmin outputs various information about what’s going on.

Do you see anything listed in that which could be a problem? For example, I’ve seen times where a warning specified in it ended up preventing it from working – where the warning was a simple matter of installing or configuring X or Y.
-Eric

Thx for the quick reply andychek.

There was one other error, but I didnt think it related.
Have added error log for info, well last 20 lines.

No errors showed up on installation, just said at the bottom of the page, successfully installed gallery please continue to http://webpage.com/gallery/index.php to complete installation

Huh, attachment didnt add so here it is:

[Mon Aug 25 14:40:49 2008] [error] [client xx.xx.xxx.xx] File does not exist: /var/www/joking/public_html/favicon.ico
[Mon Aug 25 18:52:48 2008] [error] [client xx.xxx.xx.xxx] File does not exist: /var/www/joking/public_html/favicon.ico
[Mon Aug 25 19:05:55 2008] [error] [client xx.xxx.xx.xxx] File does not exist: /var/www/joking/public_html/favicon.ico
[Mon Aug 25 19:05:57 2008] [error] [client xx.xxx.xx.xxx] Premature end of script headers: index.php
[Mon Aug 25 19:06:57 2008] [error] [client xx.xx.xxx.xx] Premature end of script headers: index.php
[Mon Aug 25 19:06:57 2008] [error] [client xx.xx.xxx.xx] File does not exist: /var/www/joking/public_html/favicon.ico
[Mon Aug 25 19:11:08 2008] [error] [client xx.xxx.xx.xxx] Premature end of script headers: index.php
[Mon Aug 25 19:11:32 2008] [error] [client xx.xxx.xx.xxx] Premature end of script headers: index.php
[Mon Aug 25 19:14:17 2008] [error] [client xx.xxx.xx.xxx] Premature end of script headers: index.php
[Mon Aug 25 19:16:14 2008] [error] [client xx.xx.xxx.xx] Premature end of script headers: index.php
[Mon Aug 25 19:19:31 2008] [error] [client xx.xxx.xx.xxx] Premature end of script headers: index.php
[Mon Aug 25 19:25:55 2008] [error] [client xx.xxx.xx.xxx] Premature end of script headers: index.php
[Mon Aug 25 19:27:50 2008] [error] [client xx.xxx.xx.xxx] Premature end of script headers: index.php
[Mon Aug 25 19:43:43 2008] [error] [client xx.xxx.xx.xxx] Premature end of script headers: index.php
[Mon Aug 25 19:46:18 2008] [error] [client xx.xxx.xx.xxx] Premature end of script headers: index.php
[Mon Aug 25 19:49:27 2008] [error] [client xx.xxx.xx.xxx] Premature end of script headers: index.php
[Mon Aug 25 19:54:20 2008] [error] [client xx.xxx.xx.xxx] Premature end of script headers: install.php
[Mon Aug 25 19:56:32 2008] [error] [client xx.xx.xxx.xx] Premature end of script headers: install.php
[Mon Aug 25 20:02:59 2008] [error] [client xx.xxx.xx.xxx] Premature end of script headers: install.php
[Mon Aug 25 20:03:06 2008] [error] [client xx.xxx.xx.xxx] Premature end of script headers: index.php

This forum is a bit like the cookie monster, except that it eats posts and attachments.

Your logfile attachment was just the latest casualty.

I suspect, as you mentioned, that there’s a PHP issue lingering within your install scripts problem.

Would you mind if I logged into your system and looked around? If that’s okay, you can email your login details to eric@virtualmin.com.

The other option is that you might want to verify that PHP itself is working, by creating a test PHP script. However, I could certainly do that for you.
-Eric

I must say I can give this site a 200% recommendation.

Its Bank holiday monday, well it is here, and the quickness of help is amazing, cant fault it.

Kev King

Okay, there’s good news, and there’s bad news :slight_smile:

The good news is that I do see the problem. In the main Apache error log, it shows this:

mod_fcgid: server /var/www/joking/public_html/test.php(1546) started
suexec policy violation: see suexec log for more details

And then, checking out the suexec log, it shows:

[2008-08-25 22:41:23]: uid: (UID/USERNAME) gid: (GID/GID) cmd: php5.fcgi
[2008-08-25 22:41:23]: command not in docroot (/var/www/USERNAME/fcgi-bin/php5.fcgi)

The SuExec related tools provided by Virtualmin are compiled with support to run under /home. The catch there is that they pretty much have to – you’ll get errors like you’re seeing if they’re run in a different environment, such as under /var/www.

I believe the only way you could run PHP scripts within /var/www is to switch the PHP execution mode to mod_php rather than CGI or FCGId.

You could do that by going into Server Configuration -> Website Options, and then modify "PHP script execution mode".

In a perfect world, that’s less desirable (since all scripts run as Apache at that point), but that might be what you’d need to do if you like the current location of your DocumentRoot.

I hope that helps :slight_smile:
-Eric

Ah thank you Eric, or I could move my virtual servers and make default location /home in future. If that makes it easier to administer at a later date.

And there was me thinking I was being clever keeping all web stuff in one place.

Will have a think and see which route to take, later.

Once again thankyou Eric very prompt, excellent.

Ah, nope still same error.

Have re installed servers under the default virtualmin setting doc root /home

But still unable to complete installation as before, strange. Same error message, premature end of script headers: install.php

Howdy,

Well, it’s a different error now showing up in the logfiles.

The “command not found docroot” error is gone – but both fcgid and cgi die off running even a basic PHP test script (running PHP’s phpinfo().

I’m struggling to figure out what’s wrong with this – so far as I can tell, the configuration looks good.

One of the biggest differences I can see between it and other Virtualmin systems is that you’re running PHP from the dotdeb repo.

That, and for whatever reason, Virtualmin doesn’t seem to have generated php.ini files in ~/etc/php5. But I attempted to account for that by have it look at the php.ini files in /etc/.

So, I suppose in an attempt to rule out the issue, would you consider installing the Virtualmin PHP package in place of the dotdeb package you have now?

If that doesn’t work, it’ll at least rule out a number of things. And that will give me some time to think of what else might be going on :slight_smile:
-Eric

Yes Eric, if we can get to the bottom of this great.

I included dotdeb because it was listed somewhere where I was reading up on something so added to expand my repo’s. Will comment out if it is going to be an issue.

Probably different error’s in log now because the doc root is now where it should be, I have set it to /home for virtual servers as per default and re-installed webs to that location. I should have mentioned that.

My wife will be chuffed if I can get her web site up and going for her.

And I can move onto the next problem, which will enevitably occur…

Kev King

Have had to get some sleep since first posting, but when I have tried this morning, login scripts are being requested to be downloaded and not giving an error now. Not sure if I am making progress or not on this. It must be a php problem but I have no idea as to where to start.

Well got to go to work now will look at it again later.

Default doc route for virtual servers is now /home as per virtualmin default setup. I was hoping that would be the cure all.

Kev King

Howdy,

Yeah, so, if you’re using FCGId, your server produces an Internal Server error. If you’re using standard CGI, it prompts to download the file as you’re seeing now. I was switching between the two in trying to test it last night and probably left it on CGI (CGI removes some more variables).

The next thing to do would be to not only comment out the dotdeb repository, but to actually remove the dotdeb PHP5 packages, and install Virtualmin’s PHP5 packages in their place.

I’m not certain they’re the culprit, but I’m running low on ideas as to what else it may be!
-Eric

Right o, before I do that, just a quick bit of advice. I take it its just a case of "apt-get remove --purge php5". I dont want to go and do anything silly and remove something by mistake. The server is working near normal at the moment, so dont want to really bugger it up, if you know what I mean.

Kev King

So, if you run this, you’ll see a list of everything that you’ll need to remove:

dpkg -l ‘php5*’

I don’t recall if your apt command will correctly remove all the other PHP5 related packages or not.

But, looking at that list on your system, I do see a number of PHP5 modules from multiple repositories mixed in there – it’s entirely possible PHP is failing due to that.

So the steps I’d take:

  • Run your above “remove” command – and balk if it offers to delete something not previously seen in your dpkg -l ‘php5*’ output :slight_smile: It should only be removing php5-* packages.
  • Comment out the dotdeb repository in /etc/apt/sources.list
  • Run apt-get update
  • Run apt-get install php5 php-cli php5-cgi php5-common php5-mysql [and any others you want]
  • Restart Apache

Try try try again! :wink:
-Eric

Erm, I forgot to add in my list above, that before installing any new php5 packages from the Debian or Virtualmin repositories, that you should re-run the dpkg -l ‘php5*’ command to verify that no php5 related packages are installed.

Make sure PHP5 is all good and un-installed before continuing!
-Eric

My god that was a bit of a bugger weedling out the last of the dotdeb entries. But all done, clean install of php5 and no signs of the dotdeb’s using dpkg -l ‘php5*’

reloaded Virtualmin and have gone to PHP page but it cant find any cofig files or route to them?, what one do I select to activate?

/etc/php5/apache/php.ini=Configuration for mod_php
/etc/php5/cgi/php.ini=Configuration for scripts run via CGI
/etc/php5/cli/php.ini=Configuration for command-line scripts

There are 3 there but none will save when that option is selected.

Sorry to be a pain.
Kev King

Here we go,

I went into Server Configuration -> Website Options, and chose FCGId. That regenerated the PHP5 related files in the fcgi-bin dir, and now it works! It’s pointing at your new PHP5 files now. I think the work you did to install the PHP5 from the other repository resolved it.

Also, choosing CGI in that same menu did the same for the files in the cgi-bin dir. So either one of those will work.

I put a test.php script in your DocumentRoot, you can go to YOURDOMAIN.com/test.php to see PHP run.

If you’re trying to choose between the 3 configs you mentioned above, I’d go with the CGI related one.

Have a good one,
-Eric

Quick update, have just tried loading a script install web page and it has loaded as it should.
Its a bit late here now so have aborted installation for now and will complete tomorrow.

It looks promising though…will update fully in the morning.

Thanks for your time and patience Eric.

Yep tis still working this morning.

Just one small problem now, anything in /var/www will not display, ie phpmyadmin will wont load, just gives the option for downloading the php script.

And there is no php.ini in any of the 3 /etc/php5 directories, so none of those 3 options will save, because it cant see any config files. I must be missing something?
I have re-installed all the php5 stuff, or thought I had, but there must be something still missing?

Am nearly there with this one.