Editing the lib.php file is one possible work around for resolving an issue with a Moodle installation completed through Fantastico De Luxe. Once the installation is complete and an administrator logs into Moodle, a blank white screen appears instead of the expected administration error. This error, caused by a PHP version mismatch can be resolved through either editing the lib.php file or manually installing an older version of Moodle that doesn't require PHP 5.3. As discussed in our introduction article regarding seeing a blank white screen in Moodle, upgrading servers to PHP 5.3 is not possible at this time.
Before making changes, making a full backup is highly recommended.
Fortunately, editing the lib.php file can easily be done through the cPanel File Manager and we'll cover each step in detail:
  1. Log into cPanel

  2. Click the File Manager icon and navigate to the question/engine subfolder inside your Moodle installation (e.g. public_html/question/engine, /public_html/moodle/question/engine or something similar depending on where you installed Moodle).

  3. Select the lib.php, right click it and choose either "Edit" or "Code Editor" to open the file for editing.

  4. Search for the following lines of code:

    public static function get_behaviour_required_behaviours($behaviour) {
    $class = 'qbehaviour_' . $behaviour;
    return $class::get_required_behaviours();
    }

  1. Replace:

    return $class::get_required_behaviours();

    With:

    eval('$ret = ' . $class . '::get_required_behaviours();');
    return $ret;

  1. The function should now look like this:

    public static function get_behaviour_required_behaviours($behaviour) {
    $class = 'qbehaviour_' . $behaviour;
    eval('$ret = ' . $class . '::get_required_behaviours();');
    return $ret;
    }

  1. Click the "Save Changes" button in the upper right of the window.

Now, when we go back to our site where Moodle is installed we can log in and see the Moodle administration area.

moodle-fixed

Did you find this article helpful?

We value your feedback!

Why was this article not helpful? (Check all that apply)
The article is too difficult or too technical to follow.
There is a step or detail missing from the instructions.
The information is incorrect or out-of-date.
It does not resolve the question/problem I have.
How did you find this article?
Please tell us how we can improve this article:
Email Address
Name

new! - Enter your name and email address above and we will post your feedback in the comments on this page!

Did you find this article helpful?

Comments

2013-03-29 2:44 pm
When I look for this expression in lib.php, it is not there:
public static function get_behaviour_required_behaviours($behaviour) {
$class = 'qbehaviour_' . $behaviour;
return $class::get_required_behaviours();
}

I've had dozens of emails giving me the 'wrong php' message which led me to the tutorial about changing the lib.php file. My site seems to be working okay but how can I stop receiving these emails?
thanks,
Bill Black

Post a Comment

Name:
Email Address:
Phone Number:
Comment:
Submit

Please note: Your name and comment will be displayed, but we will not show your email address.

Related Questions

Here are a few questions related to this article that our customers have asked:
Ooops! It looks like there are no questions about this page.
Would you like to ask a question about this page? If so, click the button below!
Need More Help?

Help Center Search

Current Customers

Email: support@WebHostingHub.com Ticket: Submit a Support Ticket
Call: 877-595-4HUB (4482)
757-416-6627 (Intl.)
Chat: Click To Chat Now

Ask the Community

Get help with your questions from our community of like-minded hosting users and Web Hosting Hub Staff.

Not a Customer?

Get web hosting from a company that is here to help.
}