Errores FAQ

De MoodleDocs

Nota: Urgente de Traducir. ¡ Anímese a traducir esta muy importante página !.     ( y otras páginas muy importantes que urge traducir)


Error: database connection failed / Error: Falló la conexión a la base de datos

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 this MySQL document 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/ If you don't want to disable SELinux, you have to allow httpd process to create network connections:
setsebool httpd_can_network_connect true

  • Mac OSX users -- if you are running MySQL on a Mac OSX, try changing $CFG->dbhost from 'localhost' to '127.0.0.1'

See also: MySQL page on common errors which lists several possible scenarios for connection failure, with advice on how to fix the problems.

I can't log in with message "Please verify that the current setting of session.save_path is correct"

This error occurs when PHP is having problems saving its session files. You may also see these other error messages displayed on the screen or in your log files:

Warning: Unknown: open(some-path/sessions/sess_acbf942a7399db3489ffa910e35d5242, O_RDWR)
failed: Permission denied (13) in Unknown on line 0
Warning: Unknown(): open(some-path/sessions/sess_acbf942a7399db3489ffa910e35d5242, O_RDWR) 
failed: No space left on device (28) in Unknown on line 0
Warning: Unknown: Failed to write session data (files). Please verify that the current 
setting of session.save_path is correct (some-path/sessions) in Unknown on line 0 

To temporarily bypass these errors, use database sessions by editing your moodle configuration file and adding this line:

$CFG->dbsessions = true;

Database sessions may overload your mysql database and are not ideal in a shared hosting environment, so if this solves the problem, you can start fixing the problem as follows:

  • Check access rights. The session.save_path should be accessible by the apache user. Try this command:
chown -R apache:apache some-path/sessions
This assumes that 'apache' is the name of the user your webserver runs under - it could also be 'nobody'.
  • Check the permissions to the directory that PHP is trying to save to (session.save_path = some-path/sessions). Set the permissions initially to 0777 (everyone read, write, execute) with this command:
chmod -R 0777 some-path/sessions
If this fixes the problem, reduce the permissions (700 is recommended).

See also: Session problems can be specific to your server environment. As an example, see this forum discussion about session problems with Lycos hosting.

Error: A server error that affects your login session was detected

If restarting your browser and logging in again to your Moodle site does not work, see the Using Moodle forum discussion about this error message.

If this was received at a Moodle.org site, the site could be in the process of updating. Please try the suggestion and/or wait and try it again. Or report it in Tracker.

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.

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 additional 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 tracker.

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) {

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 (eg, Notepad++ to remove these spaces or blank lines completely.

Error: "500:Internal Server Error"

There are several possible causes for this error. It is a good idea to start by checking your web server error log which should have a more comprehensive explanation. However, here are some known possibilities....

1. Syntax error: There is a syntax error in your .htaccess or httpd.conf files. The way in which directives are written differs depending on which file you are using. You can test for configuration errors in your Apache files using the command:

#apachectl configtest

2. PHPsuexec: Your server does not support .htaccess files, especially if it is running PHPsuexec, which is an Apache module used for increasing the security of a site on a hosted system. In this situation:

- you may also see a 403: Forbidden error.

- the webserver executes under your own username and all files have a maximum permissions level of 755. Check that this is set for your Moodle directory in your control panel or (if you have access to the shell) use this command:

#chmod -R 755 moodle

- use a PHP.INI file instead of a .htaccess in the directory where the Moodle PHP script is being executed. For example: if you are receiving a memory exhausted error when your server is executing the file moodle/admin/cron.php, use a PHP.INI file to change your memory_limit and copy it to the moodle/admin directory. Remember that for PHP4, PHP.INI files are per-directory, so you'll need to copy it to each sub-directory. If you are using PHP5 or higher on a shared host, check with your host on whether they support custom PHP.INI files, and how to create them. The syntax used in a PHP.INI file is different from a .htaccess file and you need to take out php_value/php_flag at the beginning of the line and use an equals sign to assign a value, e.g.

php_value memory_limit 128M <-- .htaccess
memory_limit = 128M         <-- php.ini equivalent 

3. Incompatible directive: You may have a directive in your .htaccess or httpd.conf files which are not compatible with your web server version. Check your webserver documentation.

Error "403: Forbidden"

Check your webserver configuration. See also the section above "500:Internal Server Error".

Fatal error allowed memory size exhausted. How do I increase my php memory limit?

You will sometimes see an error message something like this:

Fatal error: Allowed memory size of 67108864 bytes exhausted 
(tried to allocate xx bytes) in /var/www/moodle/yyyy.php

This error means that the php memory_limit value is not enough for the php script. The memory_limit value is the "allowed memory size" - 64M in the example above (67108864 bytes / 1024 = 65536 KB. 65536 KB / 1024 = 64 MB). You will need to increase the php memory_limit value until this message is not shown anymore. There are two methods of doing this.

  • On a hosted installation you should ask your host's support how to do this. However, many allow .htaccess files. If yours does, add the following line to your .htaccess file (or create one in the moodle directory if it does not already exist):
php_value memory_limit <value>M
Example: php_value memory_limit 40M
  • If you have your own server with shell access, edit your php.ini file (make sure it's the correct one by checking in your phpinfo output) as follows:
memory_limit <value>M
Example: memory_limit 40M
  • For later versions of Moodle you could be looking at figures in the region of 512M for all functions to work properly (backup and restore are particularly memory hungry). It is sensible to monitor the memory usage on your server if using these large settings.

Remember that you need to restart your web server to make changes to php.ini effective. An alternative is to disable the memory_limit by using the command memory_limit 0.

Error: "Esta página tiene un bucle de redireccionamiento"

Error: "La página no se está redireccionando apropiadamente"

Error: "La página localhost no funciona. La página te ha redirigido demasiadas veces

Error: "...el servidor está redirigiendo la solicitud para esta dirección en un modo que nunca se completará"

Usted puede intentar corregirlos ya sea :

  • Eliminando las cookies de su navegador y cerrándolo y volviendo a acceder al sitio. A veces esto arregla el problema.
  • Revise que su directorio moodledata/sessions tenga permiso para escritura. Cuando Usted accede a Moodle allí se creará un nuevo archivo.
  • Si Usted está ejecutando dos versiones de Moodle en la misma computadora, configure un cookie prefix en Administración > Servidor > Manejo de la sesión.
  • La discusión en Your session has timed out. Please login again tiene más sugerencias:
  • Navegue a: http://susitio/subdir/admin/purgecaches.php ,. Esto debería de pedirle que ingrese al sitio primeramente y después redirecciona a una página que tiene un botón para purgar todas las cachés.
  • Invocando al Cron desde su navegador de Internet (http:su_sitio/admin/cron.php) en versiones de Moodle anteriores a la 2.9
  • Eliminar el contenido de la carpeta moodledata/cache del servidor Moodle

La pagina no se esta redireccionando apropiadamente.png

Sorry, internet access to this page has been disabled by the administrator

Lo sentimos, el acceso por internet a esta página ha sido deshabilitado por el administrado

Error al instalar: ERR_TOO_MANY_REDIRECTS

  • Usted necesitará editar el archivo moodle\admin\index.php file con un editor de texto tal como Notepad++. ¡No use MS-Word!
  • Busque una línea que tenga:
redirect("index.php?sessionstarted=1&lang=$CFG->lang");
  • añádale dos diagonales invertidas para volverla un comentario, de la forma siguiente:
//redirect("index.php?sessionstarted=1&lang=$CFG->lang");
  • y vuelva a intentar instalar desde el navegador.

Fatal error: Maximum execution time of 30 seconds exceeded in...(when installing)

  • Su computadora está gastando mucho tiempo para ejecutar los scripts de instalación. el valor por defecto era de 30 segundos (aunque algunas ramas recientes de moodle lo han aumentado).
  • Presione F5 (refrescar) hasta que termine el proceso de instalkación.
  • O, edite el archivo en su_servidor_local\server\php\php.ini usando un editor de texto como por ejemplo Notepad++. ¡NO USE MS-Word!
    • Busque una línea que tenga:
max_execution_time = 30
    • Y substituya el valor de 30 segundos por un valor mucho más grande; por ejemplo 600, para que se vea:
max_execution_time = 600
    • Guarde el archivo editado y reinicie la instalación del servidor local

Error al instalar: La conexión se reinició/This site can't be reached

Install ERROR This site cant be reached.png

¿Instaló o actualizó Skype ?

  • Skype usa el mismo puerto (80) que Moodle.
  • Desinstale Skype.
  • Reinicie Windows.
  • Instale Moodle y
  • Re-instale Skype.

Revise su PC con un buen antivirus

Aumente el tiempo permitido para ejecutar scripts en Moodle

Localhost connection was restarted.png

  • Haga click en 'Stop Moodle.exe'
  • Edite (use Notepad++ o algún otro editor de texto simple; NO USE MS-Word) el archivo server/php/php.ini e increméntele el número que aparece en la línea que dice max_execution_time = :

Edit max execution time.png

  • Aumente el valor a, digamos, 10 minutos (600 segundos):

Edit max execution time to 600.png

  • Haga click en 'Start Moodle.exe'
  • Revise si el problema se resolvió; en caso contrario, siga leyendo más.

Revise si necesita aumentar el tamaño por defecto del stack

Localhost connection was restarted.png

  • Esto se ha descrito para paquetes completos de instalación para Windows en PCs y laptops con Windows 7 y Moodle 3.4, 3.5 y 3.6 .
  • Si revisa el archivo error.log file en server/apache/logs/error.log y encuentra una línea que menciona:
child process XXXX exited with status 3221226356 -- Restarting.
    • (donde XXXX es un número, cualquier número)

child process XXXX exited with status 3221226356.png

    • Usted puede tener un problema que ocurre a menudo en Windows a causa de un tamaño por defecto pequeño del stack de Apache. Y usualmente pasa al trabajar con código PHP que asigna muchos stacks.
    • Para resolver este problema, use un editor de texto (como Notepad ++, NO USE MS-WORD) y añada las tres líneas siguiente al final del archivo de configuración de Apache (../server/apache/conf/httpd.conf) :
<IfModule mpm_winnt_module>
  ThreadStackSize 8888888
</IfModule>
      • Y REINICIE Apache.

¿Tiene Google Drive?

  • Heap corruption (STATUS_HEAP_CORRUPTION). Algunos programas como por ejemplo Google Drive podrían estar causando corrupción de la pila (heap corruption).
  • El cambiar a la versión más reciente de Apache (XAMPP) podría corregir el problema.

¿Está usando XAMPP?

Vaya a XAMPP-Cotroll y abra Apache->Config->httpd.conf y añada

<IfModule mpm_winnt_module>
  ThreadStackSize 8888888
</IfModule>

al final

Vea https://moodle.org/mod/forum/discuss.php?d=38758

¿Cómo puedo corregir solamente un problema, sin actualizar todo mi sitio?

Suppose:

  • You are running an older Moodle version.
  • You are experiencing a particular bug.
  • You have searched in the tracker, and found that your problem is MDL-abc, and that it has been fixed in the latest version.
  • For some reason, you cannot upgrade your whole site, even though the latest version probably has security fixes.

Then, how can you get the fix for just this one bug, without upgrading your whole site? Well, if you are prepared to manually patch the code, you can probably get this information from the tracker. Please see |this guide.

Vea también