Installation error ver. 2.3.1 "Use of undefined constant __DIR__"

Installation error ver. 2.3.1 "Use of undefined constant __DIR__"

by Pablo Española -
Number of replies: 4

I installed Moodle ver. 2.3.1+ ($version  = 2012062501.10 in version.php) on my Bluehost.com server  with PHP ver. 5.4.5 and MySQL ver. 5.1.63-community-log. I setup the empty database and unpacked "moodle-latest-23.zip" without any hitch. When I accessed the moodle directory through the web to complete the installation (http://www.ilahas.com/generika/moodle), I got these error messages:

Notice: Use of undefined constant __DIR__ - assumed '__DIR__' in /home1/ilahasco/public_html/generika/moodle/lib/dml/moodle_database.php on line 27

Warning: require_once(__DIR__/database_column_info.php) [function.require-once]: failed to open stream: No such file or directory in /home1/ilahasco/public_html/generika/moodle/lib/dml/moodle_database.php on line 27

Fatal error: require_once() [function.require]: Failed opening required '__DIR__/database_column_info.php' (include_path='.:/usr/php/54/usr/lib64:/usr/php/54/usr/share/pear') in/home1/ilahasco/public_html/generika/moodle/lib/dml/moodle_database.php on line 27

Any idea what could be wrong?

Average of ratings: -
In reply to Pablo Española

Re: Installation error ver. 2.3.1 "Use of undefined constant __DIR__"

by Guillermo Madero -

Hi Pablo,

Are you completely sure about the PHP version in use? The "Use of undefined constant __DIR__" message error usually comes when using a 5.2.x version. Try and check in your server control panel that you have actually selected or enabled version 5.3.

In reply to Pablo Española

Re: Installation error ver. 2.3.1 "Use of undefined constant __DIR__"

by zedekiah julius -

get the latest PHP and it will work

In reply to zedekiah julius

Re: Installation error ver. 2.3.1 "Use of undefined constant __DIR__"

by Pablo Española -

I had to chat with Bluehost helpline... and it's been resolved! Here is what transpired:

Tyrell: there is no htaccess file in that directory. Ill create one now
Tyrell: updated. please test it now
You said: WOW!
You said: I thought that is automatically created?
You said: the htaccess file?
Tyrell: usually it is... is the error resolved?
You said: YES! THANKS A MILLION! What did you write in the htaccess?
Tyrell: # Use PHP5.3 Single php.ini as default
AddHandler application/x-httpd-php53s .php
You said: I admit writing htaccess files is still beyond me... I'll read up on it. Thank you so much, Tyrell!

I recommend calling your server tech help if the problem doesn't seem to respond to all logical solutions. In this case, an htaccess file was mssing. I never thought it was even required!

In reply to Pablo Española

Re: Installation error ver. 2.3.1 "Use of undefined constant __DIR__"

by Guillermo Madero -

I think that this could have been solved through the control panel.