PMF d'instal·lació
PHP - està instal·lat? I quina versió?
Escriviu un fitxer al vostre lloc web que es digui info.php, que contingui el text que segueix, i aneu-hi des del navegador:
<?PHP phpinfo() ?>
Si no passa res, és que no teniu PHP instal·lat al servidor web, o no està preparat per tractar correctament fitxers .php. Llegiu els documents d'instal·lació per trobar la informació sobre el punt de descàrrega per al vostre servidor. Llegiu la pàgina phpinfo per obtenir-ne més detalls.
Informació del servidor per al fòrum d'instal·lació
Quan deixeu preguntes al fòrum d'instal·lació, procureu proporcionar tanta informació sobre l'entorn del vostre sistema moodle com sigui possible. Penseu a fer servir aquesta plantilla al missatge que envieu:
- Nom del sistema operatiu del servidor (també la versió, si pot ser):
- Nom del navegador (amb el n. de versió, si pot ser):
- Versió del Moodle:
- El fitxer de Moodle config.php adjuntat?(S/N):
- Phpinfo adjuntat? (S/N):
Per als dos darrers, procureu proporcionar aquestes informacions com a adjunts al vostre missatge:
- Una còpia de la sortida de phpinfo que apareix al vostre navegador (llegiu les instruccions anteriors que expliquen com fer-ho).
- Una còpia del fitxer de configuració del Moodle. El trobareu al directori moodle i es diu config.php
Copieu i enganxeu ambdues informacions en un fitxer de text simple ( amb el vi, el notepad, etc) i adjunteu-lo al missatge.
Si no podeu proveir el phpinfo, procureu copiar i enganxar i completar aquesta informació:
- Versió de l'Apache:
- Versió del MySQL:
- Versió del PHP:
En instal·lacions en servidors hostatjats: passeu per l'escriptori d'administració, que hauria de proporcionar-vos aquestes dades.
- Avís de seguretat: Assegureu-vos d'haver esborrat els mots de pas en aquests fitxers abans d'enviar-los al fòrum.
Quins són i on es desen els paràmetres de configuració del Moodle?
Els paràmetres de la configuració es desen al fitxer config.php, al directori moodle. Aquest fitxer es crea durant el procés d'instal·lació. Si hi ha algun problema i la instal·lació no pot crear el fitxer, podeu provar de crear-lo manualment amb l'ajut de la documentació sobre el Fitxer de configuració Fitxer de configuració. Si us plau, recordeu que no es recomana editar manualment el fitxer i podria arribar al punt que només es veiessin pàgines en blanc, especialment si hi ha espais addicionals i/o línies en blanc després de la marca de tancament del php ("?>").
Running a health check
Moodle contains a script that will help identify common php and webserver configuration problems as well as configuration problems. It is a good idea to run this script to check if you are having post-installation problems. Use your browser to run this file:
http://www.mymoodle.com/moodle/admin/health.php
Change the above line if you have installed moodle in the webroot instead of a folder inside the webroot.
Any text I add with an apostrophe (') or a quote (") causes errors or comes up with a slash added
Problems caused by apostrophes are caused by incorrect "magic quotes" settings. Moodle requires the following settings in the php.ini file (which are usually the default):
magic_quotes_gpc = On magic_quotes_runtime = Off
Please see Installing Moodle for more details.
Email copies are not being sent from my forums
You must set up cron properly if you want Moodle to send out automatic email from forums, assignments etc. This same process also performs a number of clean-up tasks such as deleting old unconfirmed users, unenrolling old students and so on.
Basically, you need to set up a process to regularly call the script http://yoursite/admin/cron.php
. Please refer to the cron instructions.
Tip: Try the default setting in Moodle variables page. Leave the smtphost blank. This will be acceptable for the majority of users.
Tip: Make sure that allowuseremailcharset in Administration > Configuration > Variables > Mail is set to No. Setting this to Yes might cause this problem in some versions of Moodle.
Error: database connection failed
If you get errors like "database connection failed" or "could not connect to the database you specified", here are some possible reasons and some possible solutions.
- Your database server isn't installed or running. To check this for MySQL try typing the following command line
$telnet database_host_name 3306
- You should get a cryptic response which includes the version number of the MySQL server.
- If you are attempting to run two instances of Moodle on different ports, use the ip address of the host (not localhost) in the $CFG->dbhost setting, e.g. $CFG->dbhost = 127.0.0.1:3308.
- You don't have the PHP mysql or postgresql extensions installed (please refer to FAQ re. whether PHP is installed).
- You haven't created a Moodle database and assigned a user with the correct privileges to access it.
- The Moodle database settings are incorrect. The database name, database user or database user password in your Moodle configuration file config.php are incorrect. Use phpMyAdmin to set up and check your MySQL installation.
- Check that there are no apostrophes or non-alphabetic letters in your MySQL username or password.
- You are using MySQL version 4.1 or higher but the PHP MySQL extension is pre-4.1 (check in your phpinfo output). In this case the default password hashing algorithm is incompatible with that available in the PHP mysql extension versions 4.x.x. Use these MySQL commands to change the passwords to the old format:
mysql>SET PASSWORD FOR 'root'@'localhost' = OLD_PASSWORD('password'); mysql>SET PASSWORD FOR 'moodleuser'@'localhost' = OLD_PASSWORD('password');
- Also, consider upgrading your PHP MySQL extension. See http://dev.mysql.com/doc/mysql/en/old-client.html for further information on how to deal with this problem.
- You are using Fedora core 3 or some other Linux system with SELinux installed and enabled. See the following URL for information on how to disable SELinux: http://fedora.redhat.com/projects/selinux/
- Mac OSX users -- if you are running MySQL on a Mac OSX, try changing $CFG->dbhost from 'localhost' to '127.0.0.1'
I can't log in - I just stay stuck on the login screen
The most common cause for this is that your own computer (not your Moodle server) has a firewall that is stripping referrer information from the browser. Here are some instructions for fixing Norton firewall products.
The server admin can also fix this for everyone by changing the secureforms variable to 'No' in the security section of Administration >> Configuration >> Variables.
Another possible cause of this problem is that sessions are not configured properly on the server. You can test this by calling the script http://yourserver/moodle/lib/session-test.php.
If you are still having problems, read the Cannot log in page.
I keep getting this error: Failed opening required '/web/moodle/lib/setup.php'
In your config.php, the setting that you use for the dirroot variable must be the complete path from the root of your server's hard drive.
Sometimes people only use the path from their home directory, or relative to the root of the web server directory.
Make sure the URL in your $CFG->wwwroot
setting is exactly the same as the one you are actually using to access the site.
My pages show fatal errors such as : Parse error, call to undefined function: get_string()
If you see errors like:
Parse error: parse error, unexpected T_VARIABLE in /path/to/moodle/config.php on line 94 Fatal error: Call to undefined function: get_string() in /path/to/moodle/mod/resource/lib.php on line 11
then you have probably left out a semi-colon or closing quote from a line in config.php (previous to line 94).
Another possibility is that you edited config.php in a program like Word and saved it as a HTML web page, instead of using a plain text editor like Notepad.
Another thing to check, particularly if you are using 3rd party modules or plugins, is whether any of the php scripts use short open tags (<? ?>) instead of proper ones (<?php ?>). Short tags are bad for various reasons, so first contact the author of that extension to tell them about the problem. Then either replace short tags with conventional ones, or set this line in php.ini:
short_open_tag = On
You should never find short tags in core moodle code. If you do, please file a bug in the bug tracker.
Serious Error! Could not set up the site!
Please refer to the Using Moodle forum discussion Serious Error! Could not set up the site!.
Uploaded files give "File not found"
For example: Not Found: The requested URL /moodle/file.php/2/myfile.jpg was not found on this server.
Your web server needs to be configured to allow the part of the URL after a script name to be passed directly to the script. This is usually enabled in Apache 1, but is usually disabled by default in Apache 2. To turn it on, add this line to your httpd.conf, or to a .htaccess file in your local directory (see Installing Moodle for more details):
AcceptPathInfo on
Note, this will ONLY work for Apache versions 2.x.
If you are not using Apache 2 and you still have this problem (unlikely) then you can switch Moodle to use an alternative method. The disadvantages are a slight loss of performance for your users and you won't be able to use relative links within HTML resources.
To use this alternative method, you should change the slasharguments variable in the Operating System section of Administration >> Configuration >> Variables. You should now be able to access your uploaded files.
When I go to the admin page, I get told to make dirroot blank!
If you see errors like this:
Please fix your settings in config.php: You have: $CFG->dirroot = "/home/users/fred/public_html/moodle"; but it should be: $CFG->dirroot = "";
then you have encountered a small bug that occurs on some servers. The problem is with the error-checking mechanism, not with your actual path. To fix it, find this line (line 66) in the file admin/index.php:
if ($dirroot != $CFG->dirroot) {
and change it to this:
if (!empty($dirroot) and $dirroot != $CFG->dirroot) {
When trying to add a resource I receive error messages
Assuming you are using Apache, then it's quite likely that your setting in config.php for $CFG->wwwroot
is different from the actual URL you are using to access the site. Also try turning off the secureforms variable in the security section of Administration >> Configuration >> Variables.
Why are all my pages blank?
Check the dirroot variable in config.php. You must use complete, absolute pathnames e.g.
$CFG->dirroot = "d:\inetpub\sites\www.yoursite.com\web\moodle";
Another reason might be that PHP has not been configured to support MySQL. This is common on Redhat and OpenBSD installations. In this case, an error is generated, but since error displays are often disabled by default, all that is seen on the browser is a blank screen. To enable PHP error displays, set these lines in your php.ini file and reload the web page.
display_errors = On display_startup_errors = On
To determine if MySQL support is your problem, insert this as the second line in your config.php file
phpinfo();
then reload the web page. Examine the output closely to see if MySQL is supported. If not look for a package you are missing.
Why is a particular page blank or incomplete?
Check your web server log files!!
If a particular page is blank or incomplete (it doesn't display the footer), before you do anything else check your error logs.
PHP can be set up to log errors in a variety of different ways. These settings are contained in the php.ini file on the server. If you don't know were that is, edit your Moodle config.php and add the following as the second line
phpinfo();
then reload the web page. Look for the entry Configuration File (php.ini) Path.
When you have located php.ini open it in your favorite text editor. Find the Error handling and logging section of the php.ini file. Make sure that both display_errors = On and log_errors = On are present and uncommented. Check the value of error_log - this tells you the location of the file errors are logged to. If it is commented out then errors will be sent to the web server error log file. Remember, if you make any changes to this file you will need to restart the web server (or just reboot the server).
Having established that logging is working, reproduce the error. Immediately check the error log file right at the end. Hopefully you will see a PHP error message at or very near the end of the file. This may solve your problem directly or makes it a lot easier to diagnose the problem in the Moodle forums.
Installation hangs when setting-up database tables
- Sometimes the installation will hang when setting up tables. This will be an abrupt hang with half the page displayed in the browser and/or other outputs removed, e.g. the “Scroll to continue” link is displayed but no “Continue” button is there. If this is the case, it is usually a mysql error and not a php error. Check that there is no limit placed on your mysql database, e.g. a "questions" limit.
- If the install is on a webhost, adding
AddType x-mapp-php5 .php
to the .htaccess file in the moodle directory has been known to solve the problem.
- Try also renaming the .htaccess file so that it is disabled.
Why can't I upload a new image into my profile?
If you don't see anything on your user profile pages to let you upload user images then it's usually because GD is not enabled on your server. GD is a library that allows image processing.
1. Make sure GD has been included in your PHP installation. You can check this by going into Administration >> Configuration >> Variables and looking for the gdversion setting. This setting is chosen automatically every time you visit that page. If it shows GD version 1 or version 2 then everything should be fine. Save that configuration page and go back to your user profile.
2. If Moodle thinks GD is not installed, then you will need to install it. On Windows this is usually a matter of "turning on" the module in PHP (see the installation instructions for help). On Unix you may need to re-compile PHP with arguments something like this:
./configure --with-apxs=/usr/local/apache/bin/apxs --with-xml --with-gd --with-jpeg-dir=/usr/local --with-png-dir=/usr --with-ttf --enable-gd-native-ttf --enable-magic-quotes --with-mysql --enable-sockets --enable-track-vars --enable-versioning --with-zlib
3. Remember to re-visit the Moodle configuration page after making any changes to PHP so it can pick up the correct version of GD.
Please see the Using Moodle forum discussion Profile pictures for additional information.
Why do I keep getting error messages about "headers already sent"?
If you see errors like this:
Warning: Cannot add header information - headers already sent by (output started at /webs/moodle/config.php:87) in /webs/moodle/lib/moodlelib.php on line 1322 Warning: Cannot add header information - headers already sent by (output started at /webs/moodle/config.php:87) in /webs/moodle/lib/moodlelib.php on line 1323 Warning: Cannot add header information - headers already sent by (output started at /webs/moodle/config.php:87) in /webs/moodle/login/index.php on line 54
you have blank lines or spaces after the final ?>
in your config.php file. Sometimes text editors add these - for example Notepad on Windows - so you may have to try a different text editor to remove these spaces or blank lines completely.
Why doesn't my Moodle site display the time and date correctly?
Each language requires a specific language code (called a locale code) to allow dates to be displayed correctly. The language packs contain default standard codes, but sometimes these don't work on Windows servers.
You can find the correct locale codes for Windows on these two pages: Language codes and Country/region codes (e.g. "esp_esp" for spanish)
These new locale codes can be entered on the Administration >> Configuration >> Variables page, where they override the ones in the currently chosen language pack.
I can't log in with message "Please verify that the current setting of session.save_path is correct"
See this Using Moodle Forum Summary
How do I uninstall Moodle?
Moodle package installation: If you have downloaded a Moodle package, simply uninstall using your system commands. On Windows PCs, you should access the Control Panel -> Add/Remove Programs. Select the package name and click Change or Remove Programs.
Webhost/manual installation: If you have installed Moodle manually or have installed onto a webhost, follow these steps:
- Delete the moodle database using this mysql command (or delete using your mysql client, e.g. PHPMyAdmin):
sql>DROP DATABASE moodle;
- In the above example replace 'moodle' with the name of the moodle database you created when installing.
- Delete the moodledata directory. If you, or your users, have uploaded materials into this directory take a copy of these before deleting this directory.
- Delete the moodle directory itself. This will delete all of the moodle PHP script files.