Blank pages in Moodle after install - failed to install php5-mysql

Bug #234609 reported by Peter Hollands
24
This bug affects 1 person
Affects Status Importance Assigned to Milestone
moodle (Ubuntu)
Fix Released
Medium
Unassigned

Bug Description

Binary package hint: moodle

After installing Moodle to run with mysql I simply got blank pages when accessing
http://localhost/moodle/admin (I was instructed to use this URL post install by the installer).

I eventually changed a line in /usr/share/moodle/lib/setup.php changing ...
  error_reporting(o); // Hide errors
to become
  error_reporting(1); // Show errors

At this point my browser, instead of showing blank pages, displayed ....

Fatal error: Call to undefined function mysql_pconnect()
in /usr/share/moodle/lib/adodb/drivers/adodb-mysql.inc.php on line 376

So installed php5-mysql

This fixed the problem - which had been nasty, because so little information was given,
and the above change in the setup file is not obvious. The main setup file is actually in another location
( /etc/moodle/config.php )

So I now consider that the install script should check to see if you are using the mysql database,
and if you are, it should ensure that php5-mysql is installed. There must be many many hardy users that
are having this problem - or else I've just been unlucky somehow, as I upgraded from Gutysy to Hardy and may
have found a problem caused by the upgrade route.

==========================================
DATA REQUESTED BY LAUNCHPAD

lsb_release -rd
Description: Ubuntu 8.04
Release: 8.04

apt-cache policy moodle
moodle:
  Installed: 1.8.2-1ubuntu4
  Candidate: 1.8.2-1ubuntu4
  Version table:
 *** 1.8.2-1ubuntu4 0
        500 http://gb.archive.ubuntu.com hardy/main Packages
        100 /var/lib/dpkg/status

Revision history for this message
Rui Boon (ruiboon) wrote :

Thanks for reporting this bug and help make Ubuntu better.

Do you happen to have php5-pgsql installed? (apt-cache policy php5-pgsql)

Changed in moodle:
status: New → Incomplete
Revision history for this message
Peter Hollands (peter-hollands) wrote :

Look like I do have php5-pgsql installed.

apt-cache policy php5-pgsql

php5-pgsql:
  Installed: 5.2.4-2ubuntu5.1
  Candidate: 5.2.4-2ubuntu5.1
  Version table:
 *** 5.2.4-2ubuntu5.1 0
        500 http://gb.archive.ubuntu.com hardy-updates/main Packages
        100 /var/lib/dpkg/status
     5.2.4-2ubuntu5 0
        500 http://gb.archive.ubuntu.com hardy/main Packages

Revision history for this message
Rui Boon (ruiboon) wrote :

Moodle uses either mysql or pgsql as it database backend. Since you have installed php5-pgsql, it does'nt install php5-mysql as part of its dependency.

Also after the configuration screen where you get to select the database,username,password, etc., you will be warned that the script cannot connect to the server (Failed to connect to database: Can't connect to local MySQL server through socket...)

Revision history for this message
Peter Hollands (peter-hollands) wrote : Re: [Bug 234609] Re: Blank pages in Moodle after install - failed to install php5-mysql

I did not know that I had php5-pgsql installed.
And it took me two hours to track down the problem.

On Ubuntu, the script asks me to select either
"Postgres" or "Mysql" - I selected Mysql - at that point
the script should check that I have php5-mysql installed.

PLEASE NOTE: The script does not fail to connect with the
database. It successfully creates an empty database
(called moodle in my case). SO I GET NO ERROR MESSAGE
FROM THE INSTALL SCRIPT. (Could it be that the script
does not need php5-mysql ?).

Revision history for this message
Rui Boon (ruiboon) wrote :

Setting status to confirmed as i am able to replicate it (Test case A). (not sure if test case B produce the same result though. )

Dependency is an either-or type (php5-pgsql | php5-mysql). Therefore when user has either one installed, but has chosen a option that required the other to be needed, the webpage could not load. There was no warning from the postinst script as it uses perl (DBI) to connect to the database.

Test case:
(A) mysql
0) Ensure mysql is installed and running and php5-mysql is not installed
1) sudo apt-get install moodle
2) Select mysql and enter database details

(B) pgsql
0) Ensure pgsql is installed and running and php5-pgsql is not installed
1) sudo apt-get install moodle
2) Select mysql and enter database details

Actual result
The postinst script created a table in the database (correct behaviour).
However when going to the moodle webpage (http://localhost/moodle/admin), php error occurs. The error is caused by missing php5-mysql.

Expected result.
The postinst script created a table in the database
Moodle webpage works.

Changed in moodle:
status: Incomplete → Confirmed
Revision history for this message
pfaffman (pfaffman) wrote :

Rui got it right. The problem is that we need to fix the dependencies as he describes. You can install moodle without php5-mysql installed, so you get a blank screen when you go to moodle. A Normal Person (our audience) has no idea what the problem is. I went to install phpmyadmin to investigate the problem and when I did I noticed that php5-mysql got installed and lo! the problem was resolved.

This is a quick fix with no side-effects that I can imagine. It'd be nice to get this in before 8.10 gets released.

Revision history for this message
Ace Suares (acesuares) wrote :

This is still a bug in 8.10. I 'tested' it today :-(

Revision history for this message
LaserJock (laserjock) wrote :

This appears to me to not necessarily be a straightforward fix necessarily. My reading of this is that if you have php5-mysql or php5-pgsql already installed but then choose the other one in the moodle install configuration you end up with problems.

I don't think there is any dependence issue really here from how I read this, but rather an issue with the debconf questions asked during install.

The only thing I can think of to get around that would be to check what database the user has installed and only ask them to choose if they have both installed, otherwise we just go with the one they have installed. Does that make sense?

Revision history for this message
Andreas Olsson (andol) wrote :

What makes this issue even more complicated to handle transparently is the fact that the Dependencies (php5-pgsql | php5-mysql) and (postgresql-client | mysql-client) as well as the Recommends (postgresql | mysql-server) seems to be handled/picked separately. That is, you can have both mysql-server and mysql-client installed and apt will satisfy its dependencies by choosing to install php5-pgsql.

On another note. A quick, and incomplete, solution which might at least help somewhat could be to simply switch the order of the postgres- and mysql-dependencies, putting mysql first. I could be wrong, but I'm guessing that people without any special preferences usually takes the mysql track.

Revision history for this message
LaserJock (laserjock) wrote :

I'm not sure what we're going to be able to do with this but I think we know what the problem is, marking as Triaged.

Changed in moodle:
importance: Undecided → Medium
status: Confirmed → Triaged
Revision history for this message
Launchpad Janitor (janitor) wrote :
Download full text (4.8 KiB)

This bug was fixed in the package moodle - 1.9.4.dfsg-0ubuntu1

---------------
moodle (1.9.4.dfsg-0ubuntu1) jaunty; urgency=low

  * Merge with Debian git (Closes LP: #322961, #239481, #334611):
    - use Ubuntu's smarty lib directory for linking
    - use internal yui library
    - add update-notifier support back in

  [Matt Oquist]
    * renamed prerm script
    * significantly rewrote postinst and other maintainer scripts to improve
      user experience and package maintainability
      (Closes LP: #225662, #325450, #327843, #303078, #234609)

moodle (1.9.4.dfsg-1) UNRELEASED; urgency=low

  * New Upstream Version (closes: #475535, #514284, #515823)
    (added notes/ and tag/ to debian/install)
  * Merge with Ubuntu:
    - drop use of wwwconfig (closes: #389502, #302205)
    - debian/postinst: ucf fixes (fixes a hang)

  * Remove preinst (no more direct upgrades from sarge)
  * Remove PHP4 support from the Apache config file we provide
  * Drop support for apache 1.x and remove from debconf
  * Add swedish debconf translation (closes: #511202)

  * Bump debhelper compatibility to 7
  * Add lintian overrides for known customised libraries
  * Add new license files to delete (lintian warning)
  * Compress the deb with bzip2
  * Add a watch file
  * Update copyright file

  Dependencies:
  * Depend on libjs-yui instead of yui (renamed after lenny)
  * Add dependency on unzip
  * Recommend php5-xmlrpc and aspell
  * Suggest clamav
  * Demoted mimetex to recommended

  Generated config:
  * Turn 'dbpersist' on by default in the generated config.php
  * Include whitespace warning at the end of generated config.php
  * Set the path to du, unzip and zip

moodle (1.8.2.dfsg-4) unstable; urgency=high

  * Improve the fix for log URL filtering as suggested by Steffen Joeris
    (MSA-09-0007 / CVE-2009-0500)
  * Backport upstream fix for calendar export leakage
    (MSA-09-0006 / CVE-2009-0501)

moodle (1.8.2.dfsg-3) unstable; urgency=high

  * Delete unused (but vulnerable) Spellchecker plugin to htmlarea
    (MSA-09-0005, CVE-2008-5153)
  * Hide images of deleted users (MSA-09-0001)
  * Fix user pix disclosure (MSA-09-0002)
  * Fix XSS vulnerabilities in HTML blocks (MSA-09-0004)
  * Fix XSS vulnerabilities in logs (MSA-09-0007)
  * Fix CSRF vulnerability in forum code (MSA-09-0008)

moodle (1.8.2.dfsg-2) unstable; urgency=high

  [ Dan Poltawski ]
  * Patch SQL injection bug in hotpot module (MSA-08-0010)
  * Fix XSS bug in logged urls (MDL-11414)
  * Fix XSS bug in install script (MSA-08-0004)
  * Fix insufficient access control in Login as feature (MSA-08-0003)
  * Profiles of deleted users were accessible allowing for spam (MSA-08-0015)
  * Deficincy in text cleaning functions allowed for XSS (MSA-08-0021)
  * Fix CSRF in messaging settings (MSA-08-0023)
  * Fix anonymous group creation and html injection (MDL-11759)
  * Fix SQL injection bug in mnet (MDL-9288)
  * Fix SQL injection bug in restore (MDL-11857)
  * Insufficient cleaning of essay questions (MDL-12079)
  * Fix insufficient cleaning of PARAM_HOST (MDL-12793)
  * Fix XSS bug in logged urls (MDL-11414)
  * Fix uncleaned params in wiki (MDL-14806)

  [ Francois Marier ]
  * Update ht...

Read more...

Changed in moodle:
status: Triaged → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.