Código PHP:
function db_connect($url) {
$url = parse_url($url);
// Check if MySQL support is present in PHP
if (!function_exists('mysql_connect')) {
// Redirect to installer if using default DB credentials
if ($url['user'] == 'username' && $url['pass'] == 'password') {
include_once 'includes/install.inc';
install_goto('install.php');
}
drupal_maintenance_theme();
drupal_set_header('HTTP/1.1 503 Service Unavailable');
drupal_set_title('PHP MySQL support not enabled');
print theme('maintenance_page', '<p>We were unable to use the MySQL database because the MySQL extension for PHP is not installed. Check your <code>PHP.ini</code> to see how you can enable it.</p>
<p>For more help, see the <a href="http://drupal.org/node/258">Installation and upgrading handbook</a>. If you are unsure what these terms mean you should probably contact your hosting provider.</p>');
exit;
}
// Decode url-encoded information in the db connection string
$url['user'] = urldecode($url['user']);
// Test if database url has a password.
if(isset($url['pass'])) {
$url['pass'] = urldecode($url['pass']);
}
else {
$url['pass'] = '';
}
$url['host'] = urldecode($url['host']);
$url['path'] = urldecode($url['path']);
// Allow for non-standard MySQL port.
if (isset($url['port'])) {
$url['host'] = $url['host'] .':'. $url['port'];
}
// - TRUE makes mysql_connect() always open a new link, even if
// mysql_connect() was called before with the same parameters.
// This is important if you are using two databases on the same
// server.
// - 2 means CLIENT_FOUND_ROWS: return the number of found
// (matched) rows, not the number of affected rows.
$connection = @mysql_connect($url['host'], $url['user'], $url['pass'], TRUE, 2);
if (!$connection) {
// Redirect to installer if using default DB credentials
if ($url['user'] == 'username' && $url['pass'] == 'password') {
include_once 'includes/install.inc';
install_goto('install.php');
}
// Show error screen otherwise
drupal_maintenance_theme();
drupal_set_header('HTTP/1.1 503 Service Unavailable');
drupal_set_title('Sitio Web en Mantenimento');
print theme('maintenance_page', '<p>El sitio Web esta en mantenimiento, por favor regrese en unos minutos.</p>');
exit;
}
Ahora sucede algo raro, cuando intentamos ingresa a la pagina directamente http://www.dominio.com ,a veces, nos aparece este mensaje de error, pero si ingresamos a una carpeta definida dentro del Drupal http://www.dominio.com/nuevo/ ingresa normal, como si no hubiera algun problema alguno, pero si volvemos a la pagina anterior nos aparece lo mismo "Sitio en Mantenimiento".
A que se puede de deber?, a que no hace la correcta conexion a la BD??, pero si eso pasa en esa direccion porque en otra carga normal?.
Ojala y me puedan ayudar en esto.
Gracias