Get 500 Internal Server Error or incorrect paths with Install.php

Get 500 Internal Server Error or incorrect paths with Install.php

by Kathy Miles -
Number of replies: 23
I'm not an experienced server user and am attempting to install Moodle 1.9 (new installation, downloaded a couple of weeks ago as a zip file) on what I believe to be an Apache (probably Apache 2) commercial Webhost server, which tells me this about my web site:

Platform type - Debian
MySQL - 5.0.45
PHP - 4.4.7
CGI - Active

My browser = Firefox 2.0.0.14

My Problem: I've followed Moodle's installation instructions for setting up my server, including creating an .htaccess file in the Moodle directory on the webhost server (I do not have direct access to anything like httpd.config). However, when I attempt to install Moodle using the install.php file, I get this error message:

"500 Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request."

If I delete the .htaccess file and run the install.php again, then I get these installation-screen messages:

PHP Warning: Unknown(): open(/var/php_sessions/sess_6bfaa973c2f2ea517f1dd936266468ee, O_RDWR) failed: No such file or directory (2) in Unknown on line 0

PHP Warning: Unknown(): Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/var/php_sessions) in Unknown on line 0

It looks like there's an incorrect path, therefore - but I have NO idea why or what to do about it.

Does anyone have any suggestions on how to solve this?
Should I perhaps be using the PHP.INI file instead of the .htaccess file? And if so, how do I do that?

I'd much appreciate help with this.

Kathy
Average of ratings: -
In reply to Kathy Miles

Re: Get 500 Internal Server Error or incorrect paths with Install.php

by Ken Wilson -

Hi Kathy

Two points which hopefully will help things:

  1. The 500 internal server error means that either a directive in the .htaccess file is incompatible with your webserver or your host does not allow you to use a .htaccess file. Can you please ask them if they do allow a .htaccess file? If they say "Yes", attach the file you used in a post-back for us to take a look at.
  2. The PHP warning error is saying that PHP cannot save it's session data in the path /var/php_sessions. Again, this is something to take-up with your host - they should be able to check the permissions on that directory and set them correctly for the apache user.

Let us know how things go!

Thanks

Ken

In reply to Ken Wilson

Re: Get 500 Internal Server Error or incorrect paths with Install.php

by Kathy Miles -
Hi Ken,

Thanks for the response and the information. The server does allow .htaccess, as they have an .htaccess editor as one of their vdeck control panel options. That is what I used to create the .htaccess file, but their support people told me only that it didn't work, not why. I've attached what I put into my two attempts with the .htaccess file for you to see.

Also, they are the ones who told me that the path was incorrect, although I will certainly ask about the permissions issue. Here is the message I got back from the support person about this isssue:

The various .htaccess files created were causing the 500 errors. I removed them and the errors went away. [Note: Although I had created a couple of files, as far as I knew there was only one present at the time he looked at my site.] As to the issue with moodle installing, it appears that the various configuration files have incorrect paths, based off of your cgi_error_log in your stats directory, also viewable through the cgi section of your vdeck 3.0.

He went on to suggest I contact their sales department to seek professional help (and pay for it, of course.)

I can attach only one file in this forum, so I've not attached the cgi error log he mentions, just the htaccess file. However the log consists of errors similar to the two I posted originally about the PHP warning, except it includes all the install commands, not just the first two I posted as samples. And I think the server DOES want the .htaccess file, as when the first support person I spoke with put a blank .htaccess file up, the install at least wanted to work (but with the WARNING results), instead of giving an Internal System Error. Once I put the commands in the attached file in, though, the 500 error came back.

Kathy
P.S. I just found this listed as the PHP path: /usr/local/bin/php
In reply to Kathy Miles

Re: Get 500 Internal Server Error or incorrect paths with Install.php

by Ken Wilson -

Thanks for uploading the .htaccess file Kathy. The problem could be caused by not using php_value and php_flag infront of each of the lines which control the php settings. Below is an amended version with some corrections:

DirectoryIndex index.php index.htm index.html default.htm default.html home.htm home.html Home.html

AcceptPathInfo on

php_flag safe_mode 0
php_value memory_limit 40M
php_flag session.save_handler files  
php_flag magic_quotes_gpc 1
php_flag magic_quotes_runtime 0
php_flag file_uploads 1
php_flag session.auto_start 0
php_flag session.bug_compat_warn 0

LimitRequestBody 0
php_value post_max_size 16M
php_value upload_max_filesize 16M

#Added these as extra based on Moodle Install docs
php_flag short_open_tag 1
php_flag register_globals 0

You can see that the PHP settings have either php_value or php_flag in front of them to differentiate them from Apache settings. Please can you use your .htaccess editor and replace the file you have with the above and see if it makes any difference.

As for the sessions folder error, can you please post-back the output from your phpinfo file. This document tells you how to generate one.

Ken

Average of ratings: Useful (1)
In reply to Ken Wilson

Re: Get 500 Internal Server Error or incorrect paths with Install.php

by Kathy Miles -
Ken,

No luck. I created the new .htaccess file in the moodle directory but again got the "500 Internal Server Error: The server encountered an internal error or misconfiguration and was unable to complete your request." Same thing when I replaced the "AcceptPathInfo on" with the 3 lines for Apache 2.

Then I created and upload the info.php file as directed in the document link you provided. Again, when I asked for it (http://wis2well.ipower.com/moodle/info.php), I got the same 500 error as above' thus I have no file to attach with information. Meanwhile, I also called the iPower support desk again, and they told me they didn't know about the permissions and that because the higher-level tech had said I needed to go to their "sales office for professional help" they really could not help me further - that it was an issue their "engineering help" - the pros, I guess - could easily take care of.

So, unless you have some other good idea, it looks like I'm stuck. But I truly appreciate your help!

Kathy
In reply to Kathy Miles

Re: Get 500 Internal Server Error or incorrect paths with Install.php

by Ken Wilson -

The only suggestion that I have is to try to find out which line is causing the problem with the server. Do this by adding a hash symbol "#" in front of all the lines to comment it out. Then remove it from the first line, save the file and check if you get a server error. Repeat down the file until you come to the line which causes the problem. Once you hit such a line, comment it out again and keep going. You should then have a list of directives which are causing problems.

To get a phpinfo file, try deleting the .htaccess file and checking if you can see a listing.

Average of ratings: Useful (1)
In reply to Ken Wilson

Re: Get 500 Internal Server Error or incorrect paths with Install.php

by Richard Enison -
KM & KW,

I would only add that if all else fails, I would change the line

php_flag session.save_handler files

to

php_value session.save_handler files

RLE
In reply to Richard Enison

Re: Get 500 Internal Server Error or incorrect paths with Install.php

by Kathy Miles -
Hi Ken and Richard,

Taking out the .htaccess file worked, so I've attached the info.php file - thanks!

Meanwhile, I'll try amending the .htaccess, first as Richard suggested (the simplest), and if that doesn't work, by commenting lines as you, Ken, suggest.

THANKS!

Kathy
In reply to Richard Enison

Re: Get 500 Internal Server Error or incorrect paths with Install.php

by Kathy Miles -
Here's the update:

1. Changing the php_flag to
php_value did nothing to correct the issue

2. Commenting out the lines worked ONLY when the lines with no php_xxx were working (in red, below), so this is the only version that worked (indicating the server is apache2 apparently) -- meaning, I gather, the server doesn't like any of the php commands.

DirectoryIndex index.php index.htm index.html default.htm default.html home.htm home.html Home.html

<IfDefine APACHE2>
AcceptPathInfo on
</IfDefine>

#php_flag safe_mode 0
#php_value memory_limit 40M
#php_flag session.save_handler files
#php_flag magic_quotes_gpc 1
#php_flag magic_quotes_runtime 0
#php_flag file_uploads 1
#php_flag session.auto_start 0
#php_flag session.bug_compat_warn 0

LimitRequestBody 0
#php_value post_max_size 16M
#php_value upload_max_filesize 16M

##Added these as extra based on Moodle Install docs
#php_flag short_open_tag 1
#php_flag register_globals 0

That's all to report at this moment.

Kathy
In reply to Kathy Miles

Re: Get 500 Internal Server Error or incorrect paths with Install.php

by Ken Wilson -

Hi Kathy

1. It looks like ipower is preventing you from having php directives in your .htaccess file. The Installation doc does say: "This only works on Apache servers and only when Overrides have been allowed in the main Apache configuration", which means they have to have at least 

AllowOverride Options FileInfo

in their main Apache configuration file - which they appear not to have done.

2. There is, however, this thread. By adding this line:

AddType x-mapp-php5 .php

the ipower server uses PHP5, which appeared to solve the problems.

Let us know how it goes!

Ken

Average of ratings: Useful (1)
In reply to Ken Wilson

Re: Get 500 Internal Server Error or incorrect paths with Install.php

by Kathy Miles -
Well, I added the line you gave me to access php5, just after the DirectoryIndex line figuring it needed to be near the beginning; however, I still get the same installation-screen messages shown by Xavier in his Dec. 2, 07 inquiry (which are also what I've been getting all along):

Screen 1:
Warning: Unknown(): open(/var/php_sessions/sess_605fe3e1144a86b32443af74845b04fc, O_RDWR) failed: No such file or directory (2) in Unknown on line 0

Warning: Unknown(): Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/var/php_sessions) in Unknown on line 0

Screen 2 after pressing Next:

Notice: Undefined index: dirroot in /hermes/bosweb/web022/b227/ipw.wis2well/public_html/moodle/install.php on line 136

Notice: Undefined index: dirroot in /hermes/bosweb/web022/b227/ipw.wis2well/public_html/moodle/install.php on line 137

Notice: Undefined index: dataroot in /hermes/bosweb/web022/b227/ipw.wis2well/public_html/moodle/install.php on line 138

Notice: Undefined index: admindirname in /hermes/bosweb/web022/b227/ipw.wis2well/public_html/moodle/install.php on line 139

Warning: main(/lib/adminlib.php) [function.main]: failed to open stream: No such file or directory in /hermes/bosweb/web022/b227/ipw.wis2well/public_html/moodle/install.php on line 147

Fatal error: main() [function.require]: Failed opening required '/lib/adminlib.php' (include_path='.:/usr/local/lib/php-4.4.7/lib/php') in /hermes/bosweb/web022/b227/ipw.wis2well/public_html/moodle/install.php on line 147

Warning: Unknown(): open(/var/php_sessions/sess_605fe3e1144a86b32443af74845b04fc, O_RDWR) failed: No such file or directory (2) in Unknown on line 0

Warning: Unknown(): Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/var/php_sessions) in Unknown on line 0

====================================================================

At least the install starts with PHP5, but still no go. I even tried putting in the AllowOverride Options FileInfo near the top, but again got the 500 Internal System Error. Same when commenting out all but one line at a time of the other lines, as before. So, I'll call and try again to get them to set my permissions, as you suggested to me and Xavier, but they seem to want to charge me for that at this point. Bummer!

BTW, is there a way I can email Xavier directly to ask him if he used the .htaccess or something else? Since he's on iPower too, perhaps he would have another idea, but he's probably not checking the forums now that his problem got solved.

Kathy
In reply to Kathy Miles

Re: Get 500 Internal Server Error or incorrect paths with Install.php

by Richard Enison -
KM,

  1. When I clicked on Xavier Johnson's name it took me to a screen that said he is no longer enrolled in the Using Moodle course, so the answer is no, we can't get his e-mail address, we can't even send him a private Moodle msg.
  2. In your previous post you showed the php-related directives commented out, as you said, but I couldn't help noticing that the one setting the value of session.save_handler was still shown as php_flag rather than php_value. I thought you said you had made that change. Just because that change by itself didn't solve your problem (I would have been surprised if it had) doesn't mean you should change it back. I am very sure it should be php_value. The PHP manual indicates session.save_handler is of type string, not boolean. Only boolean settings are to be set with php_flag. Of course, as long as it is commented out it doesn't matter one way or the other. It is unclear to me whether you tried uncommenting these directives after changing to PHP5.
  3. Have you checked that the directory /var/php_sessions exists, and that you have write access to it? That was KW's suggestion to Johnson if switching to PHP5 didn't fix it.
  4. I don't have Moodle 1.9 on my computer yet, so it would be difficult to debug the PHP errors you list just now, but maybe a little later ...
RLE
Average of ratings: Useful (1)
In reply to Richard Enison

Re: Get 500 Internal Server Error or incorrect paths with Install.php

by Kathy Miles -
Richard,

In a post before yours came in I noted that I had fixed the problem by using the php.ini file instead of .htaccess - you may have seen that already - although then I ran into another problem.

In reply to your point #2 above, you ask about the use of flag vs. value. I did try it both ways as I uncommented lines in the .htaccess file, and neither worked (as the .htaccess file was apparently itself a problem). Now that line is in the php.ini and has none of the php_ items in front of it, so all is well.

Thanks very much for your help.

KSM

In reply to Ken Wilson

Re: Get 500 Internal Server Error or incorrect paths with Install.php

by Kathy Miles -
Hi Ken,

Well, I finally got to a support person at iPower who was able to show me where to find the php.ini file for my site, so I was able to dispense with the non-working .htaccess file and insert the same command lines in the php.ini file instead - resulting in beginning a successful installation, at last. However, now I've run into the same issue as Xavier, getting stuck again with a "We could not connect to the database you specified. Please check your database settings" message.

I can't see that any of the possible problems indicated in the http://docs.moodle.org/en/Installation_FAQ#Error:_database_connection_failed information applies to my database, and I don't really know where to go next or what to do at this point. And of course, the installation won't let me go forward unless I resolve this. Any more suggestions?

Kathy
In reply to Kathy Miles

Re: Get 500 Internal Server Error or incorrect paths with Install.php

by Ken Wilson -

Hi Kathy

Good to see that things are starting to work! Just to tidy-up things, can you please let us know where the php.ini file was located, as it may be helpful to others who try to install on iPower.

It's important to check that your database host server, database name, database username and database password are correct - if any of these aren't right Moodle will not be able to connect to the database and you'll get this error message.

So check carefully in your control panel (from iPower's website you may be using VDeck) at the MySQL management page that the name of the host, database, user and password matches what you are entering into Moodle. For most hosting companies, the host is the difficult part to get right - it should be displayed somewhere on the MySQL screen and maybe something like wis2well.ipowermysql.com (your domainname combined with the webhost's name). The database may also be pre-created for you, or you can just use "moodle" if you have a choice to. For the user, try to use "moodleuser" - never "root" and then choose a password.

Any progress?

Ken

Average of ratings: Useful (1)
In reply to Ken Wilson

Re: Get 500 Internal Server Error or incorrect paths with Install.php

by Kathy Miles -
Ken,

Yes, I should have indicated where the php.ini file was, so here it is. After one logs on to iPower VDeck control panel, in a left-hand panel there is a Control Panel Nav section with links to various items. One of those is "Scripting and Add-ons." That opens up to several links, including both CGI and Scripted Language Support and Manage MySQL. The former goes to a screen which includes a link to PHP and the .ini file editor. That's also where I was also able to change to PHP5.

The Manage MySQL link is where I found the information you describe above about the host, database, user and password for my moodle database. Right now I can't check it again as that particular iPower server seems to be down, according to a message I'm getting when I try to go to the page. The database name, user, and password were created by us prior to attempting the install, as moodle directs, so I know what those are and they are correct. It's just the host that I can't check again, at the moment, and I suspect that's where the problem lies as I didn't look at that too carefully. I'll let you know more when I can get to the server.

Kathy




In reply to Ken Wilson

Re: Get 500 Internal Server Error or incorrect paths with Install.php

by Kathy Miles -
Ken (and Richard),

Hurray, SUCCESS!! Once iPower was accessible again I checked out the Manage MySQL information, and I did have an incorrect host name. Once I fixed that the rest of the installation progressed without a flaw!!

Thanks to you both for all of your much appreciated help.

Kathy
In reply to Ken Wilson

Re: Get 500 Internal Server Error or incorrect paths with Install.php

by Rubén Darío Portillo Torales -
Hi, I have the same problem of Kathy. I have no access to php configuration, because i have my moodle on Hostgator server. I try to use the .htacces with this configuration in my moodle directory(http://www.almamater-py.com/elearning) or my dirroot is /public_html/elearning/:

"
DirectoryIndex index.php index.htm index.html default.htm default.html home.htm home.html Home.html

AcceptPathInfo on

php_flag safe_mode 0
php_value memory_limit 40M
php_flag session.save_handler files
php_flag magic_quotes_gpc 1
php_flag magic_quotes_runtime 0
php_flag file_uploads 1
php_flag session.auto_start 0
php_flag session.bug_compat_warn 0

LimitRequestBody 0
php_value post_max_size 16M
php_value upload_max_filesize 16M

#Added these as extra based on Moodle Install docs
php_flag short_open_tag 1
php_flag register_globals 0
"
But I have this error :

" The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, webmaster@almamater-py.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.


Apache/1.3.39 Server at www.almamater-py.com Port 80 PHP version 4.4
"
When I delete my .htaccess all back to run well
In reply to Rubén Darío Portillo Torales

Re: Get 500 Internal Server Error or incorrect paths with Install.php

by Ken Wilson -

Hi Rubén

Have you tried contacting HostGator to double-check if they allow .htaccess files? Some hosts don't, in which case try using a php.ini file instead. Also, see this in the Installation FAQ for more information.

Ken

Average of ratings: Useful (1)
In reply to Ken Wilson

Re: Get 500 Internal Server Error or incorrect paths with Install.php

by Nadav Kavalerchik -
Picture of Core developers Picture of Plugin developers Picture of Testers Picture of Translators
i have the same issue , now that i have upgrade moodle into a new server.

i use cpanel and their is no place to edit the php.ini file sad
i tried to put it in the moodle's main folder but with no help.

any ideas ?
In reply to Nadav Kavalerchik

Re: Get 500 Internal Server Error or incorrect paths with Install.php

by Richard Enison -
NK,

First of all, see an earlier post of mine, http://moodle.org/mod/forum/discuss.php?d=94601#p417895

Now, since you are evidently using a commercial web host, you don't have direct access to their php.ini file. Since putting it one in the main Moodle folder didn't help, I would conclude you are using PHP version 5 or higher (please don't use 5.0.x; it is very buggy and incompatible with Moodle).

If you have read the other posts in this thread (discussion), you know about using .htaccess to do PHP settings when you don't have access to php.ini. Of course, this only works if your web server is Apache (if it is running under Linux, it almost certainly is; also, see http://docs.moodle.org/en/Installation_FAQ#System_information_needed_for_Installation_Forum). In addition, it only works if your web host allows the use of .htaccess files, and if they allow the use of the directives in that file that you need to use.

Finally, some web hosts have a way for you to create a custom php.ini. So the bottom line is, you need to contact tech support for your host and ask
  1. if they allow .htaccess (if the web server for your account is Apache),
  2. if they allow php_flag and php_value in it, and
  3. if they have a procedure for creating a custom php.ini file, and if so, what that procedure is.
RLE
In reply to Richard Enison

Re: Get 500 Internal Server Error or incorrect paths with Install.php

by Nadav Kavalerchik -
Picture of Core developers Picture of Plugin developers Picture of Testers Picture of Translators
thank you for your reply smile

i have checked the php_flags with my webmaster and it was already in the main php.ini . so i removed all the php.ini files.

after some playing around... i removed the .htaccess file too and the entire site seems to come alive again and everything works fine !

thanks for the info and the help smile
In reply to Nadav Kavalerchik

Re: Get 500 Internal Server Error or incorrect paths with Install.php

by John McLeod -
I just had the same issue with the same error as I was installing 1.9.2 I am also using cPanel to access my hosted server. It turned out that when I accessed the PHP Config from the Home Page in cPanel, the pHp was set to PHP4, and when I changed it to PHP5 everything worked great.
In reply to John McLeod

Re: Get 500 Internal Server Error or incorrect paths with Install.php

by Mohammad Daradkah -

Guys i have this problem

i have created a new subdomain " online.rsica.edu.jo ", installed moodle on it using Cpanel on hostgator.

now i'm having this Internal error

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, webmaster@online.rsica.edu.jo and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.


Apache Server at online.rsica.edu.jo Port 80 "
 
Can you help guys plz !!!