Clarification re. MySQLi

Clarification re. MySQLi

by David Dunn -
Number of replies: 17

Hi,

After reading through previous threads re. the installation error,

"PHP has not been properly configured with the MySQLi extension so that it can communicate with MySQL. Please check your php.ini file or recompile PHP. MySQLi extension is not available for PHP 4."

it is confusing to read in the installation instructions that "Moodle 2.0 needs PHP v 5.2.8" and "Moodle will use MySQL [...]".

Is it not the case that Moodle 2.x will not use MySQL, only MySQLi? Thus in cases of PHP pre-5.3.x, I need to install the MySQLi extension and recompile the php.ini.

Is this correct?

- David

P.S.

Screenshot of db options: Note MySQL missing:

Moodle_db_selection_screenshot

Other info:

Moodle 2.1 (build: 20110701)

Apache version 2.2.17
PHP version 5.2.16
MySQL version 5.0.92-community
Architecture i686
Operating system linux
Average of ratings: -
In reply to David Dunn

Re: Clarification re. MySQLi

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Moodle will use the MySQL database.

PHP accesses your MySQL database using its 'mysqli' driver. It in fact does have an older driver called 'mysql' but Moodle does not support this. I think you are getting the actual database and the PHP driver for it mixed up. HTH.
In reply to Howard Miller

Re: Clarification re. MySQLi

by David Dunn -

Howard wrote:

"It [PHP?] in fact does have an older driver called 'mysql' but Moodle does not support this."

So the latest versions of Moodle do not support mysql?

Why else would there be no mysql option in the dropdown menu in the db config during the installation?

In practical terms, my university is not not prepared to install the MySQLi extension, nor update PHP to version 5.3. Should I therefore conclude that I cannot install Moodle 2.x in this environment? angry

 

- David

In reply to David Dunn

Re: Clarification re. MySQLi

by Erik Ordway -


Yes given your environment installation of moodle 2.x is not possible.  Version 5.2.8 (the minimum to run moodle 2.x) was released 08 December 2008.  It is unfortunate that IT group will not update.  

Per http://docs.moodle.org/20/en/Installing_Moodle#Software

Moodle requires a web server environment and will run in Apache and IIS easily. Moodle should run in any server environment that supports PHP. Moodle is written in the PHP scripting language. Currently, Moodle v 1.9.x requires a minimum of PHP v4.3.0 to run. Moodle 2.0 needs PHP v 5.2.8. There have been some issues with deprecated tags in PHP v 5.3.0 which have a negative impact on a number of PHP Apps, Moodle not exempted, so please ensure your PHP version is later than v 5.3.2 if using a v5.3.x. There has also been reported some issues installing Moodle with PHP-Accelerator. See the PHP Moodle version requirements here PHP settings by Moodle version for more information. Moodle will use MySQL, MSSQL, PostgreSQL or Oracle as a database, but no others. There is some real issues in the interoperability interface of different databases, which complicates the whole issue. For version information, you can go to the Download page and that will describe version requirements for available packages. If you want to run Moodle on your own computer, please see Installing Apache, MySQL and PHP for step-by-step instructions for installation on most popular platforms.

In reply to Erik Ordway

Re: Clarification re. MySQLi

by David Dunn -

Hi Erik,

I noted in my original post that we have PHP 5.2.16, released 16 Dec. 2010; according to you, therefore, this is later than the minimum of 5.2.8.

Right?

mixed

In reply to David Dunn

Re: Clarification re. MySQLi

by Erik Ordway -

My apologies.  I missed that you were installing moodle 2.1.  So you are still out of luck.  I updated the wiki page to not the requirments for 2.1.

In reply to Erik Ordway

Re: Clarification re. MySQLi

by David Dunn -

Thanks Peter and Erik for the clarification. I will do a fresh install using Moodle 2.0.3 and see how that goes.

David

In reply to Erik Ordway

Re: Clarification re. MySQLi

by David Dunn -

Oh what?! Just tried to install using Moodle 2.0.3+ (Build 20110708) and have exactly the same problem as in the screenshot in my first post above: There is no option for plain MySQL!

Do I have to go back to pre-2.0? (not gonna happen)

In reply to David Dunn

Re: Clarification re. MySQLi

by Peter Loesche -

Hi, David,

as PHP 4 is sometimes used by default you must add an .htaccess file with: AddType x-mapp-php5.php

and place it to the root folder of the Moodle 2.0.x.

Then choose Mysqli as database driver in the installation menu.

Look at http://moodle.org/mod/forum/search.php?search=.htaccess+addtype&id=5

Good luck.

In reply to Peter Loesche

Re: Clarification re. MySQLi

by David Dunn -

Hi Peter,

O .... K .... I added the text

AddType x-mapp-php5.php

to the end of the existing .htaccess file at the root directory of Moodle. When I then open the webpage for the Moodle Install, I get an Internal Server Error warning. Deleting the line above restores the installation to what is was at the beginning of this thread.

The .htaccess file reads

# -FrontPage-

IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*

<Limit GET POST>
order deny,allow
deny from all
allow from all
</Limit>
<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>
AuthName moodle.hz.nl
AuthUserFile /home/moodle/public_html/_vti_pvt/service.pwd
AuthGroupFile /home/moodle/public_html/_vti_pvt/service.grp

What do you think?

 

- David

In reply to David Dunn

Re: Clarification re. MySQLi

by Peter Loesche -
Hi, David,
your .htaccess looks very complicated. Looking for a solution I found http://docs.moodle.org/20/en/Errors_FAQ#Error:_.22500:Internal_Server_Error.22 and there the sentence : "Incompatible directive: You may have a directive in your .htaccess ... which are not compatible with your web server version" .
So first just try .htaccess with one directive :
AddType x-mapp-php5 .php
If the errors still resist we probably need help from the community.
In reply to Peter Loesche

Re: Clarification re. MySQLi

by David Dunn -

I tried what you suggested and on the intallation page, I got the php script text from the index.php file, i.e.

. /** * Moodle frontpage. * * @package core * @copyright 1999 onwards Martin Dougiamas (http://dougiamas.com) * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ if (!file_exists('./config.php'))

[etc.]

I also got this text when I placed the AddType directive higher in the lines of my original .htaccess file; the internal server error was produced only when the AddType directive was the last line.

I'll take this back to the IT people at the university where I'm trying to install Moodle. Who else in Moodle.org could help?

- David

In reply to David Dunn

Re: Clarification re. MySQLi

by Peter Loesche -

Hi,

it seems that the web server is not running the php-code. You could try phpinfo, see http://docs.moodle.org/20/en/phpinfo and there "Displaying phpinfo outside of Moodle". If this simple operation fails it is probably a problem of the web server configuration.

Another suggestion : How about installing Moodle 1.9.x for the moment ? As you can not upgrade to Moodle 2.1 on this server, you are forced to migrate to another server earlier or later. Moodle 2.1 upwards is able to import backups of version 1.9.x, thus you could begin without fears to loose your work.

In reply to Peter Loesche

Re: Clarification re. MySQLi

by David Dunn -

Hi Peter,

I successfully got a full phpinfo display outside Moodle, so I guess it is working fine.

I cannot determine if anything is amiss in the data -- would there be any sense in you or someone else looking at it?

Re. your suggestion, I do in fact have Moodle 2.1 on a personal, shared server that I've used for all our courses until now. My university wanted to bring the courses in-house rather than having them sit under a single employee's private domain, but it seems that the follow-through is ... less than optimal.

In reply to David Dunn

Re: Clarification re. MySQLi

by Peter Loesche -

Hi, David,

now it gets a little clearer. My suggestions based on my experiences and the reports from other users in this forum. I've asked myself all the time where you've got these .htaccess directives. Now I've found somewhere else about the Addtype directive to activate php5: "The name "x-mapp-php5" is not a standard but is defined by 1 & 1. If you want to work with this directive, you must use the name that your provider has determined (with the Apache-Action directive). If PHP5 running as a module, the chances are pretty high that it is the default "application / x-httpd-php". When using the CGI version, the providers have taken anything else for it." (Translated by machine).

My provider is 1&1 and I've the same problem as you, the php-version on my managed server is not sufficient for Moodle 2.1, but 1.9.x runs stable. Perhaps you have the advantage that the IT staff of your university can advise you.

I'm surprised that Moodle 2.1 is running on a shared server. If you could say something about the environment you would probably enjoy many others who tried this but failed.

In reply to Peter Loesche

Re: Clarification re. MySQLi

by David Dunn -

Thanks for all your help, Peter. I will forward your suggestion to my colleagues and take it from there.

- David

In reply to David Dunn

Re: Clarification re. MySQLi

by Peter Loesche -

Hi, David,
some last (but not so famous) words. A few months ago I succeeded to install Moodle 2.0 and I could even upgrade to 2.0.1. The tests showed that some features needed most  (file up and download, backup and restore etc.) not worked really well on all versions (although this could be caused by my server). So I decided to wait for version 2.1, but the requirements for the php-version have changed. Since I have not the ability to upgrade to 2.1 I decided not to use Moodle 2.x for productive use with students on this server. Good luck anyway.