I've cloned a Craft 3 repo that was created by another developer and I'm trying to get it running on my local server but I get
HTTP 503 – Service Unavailable – craft\web\ServiceUnavailableHttpException
I've created a quick db test script to test my database connection…
<?php
$dbname = 'local';
$dbuser = 'root';
$dbpass = 'root';
$dbhost = 'localhost';
$link = mysqli_connect($dbhost, $dbuser, $dbpass) or die("Unable to Connect to '$dbhost'");
mysqli_select_db($link, $dbname) or die("Could not open the db '$dbname'");
$test_query = "SHOW TABLES FROM $dbname";
$result = mysqli_query($link, $test_query);
$tblCnt = 0;
while($tbl = mysqli_fetch_array($result)) {
$tblCnt++;
#echo $tbl[0]."<br />\n";
}
if (!$tblCnt) {
echo "There are no tables<br />\n";
} else {
echo "There are $tblCnt tables<br />\n";
}
?>
which works fine. The settings for the db are the same as in my .env
file…
# Craft general settings
ENVIRONMENT="dev"
SECURITY_KEY="[email protected]_t3DaoZZnY"
# Craft database settings
DB_DRIVER="mysql"
DB_SERVER="localhost"
DB_USER="root"
DB_PASSWORD="root"
DB_DATABASE="local"
DB_SCHEMA="public"
DB_TABLE_PREFIX=""
DB_PORT="4095"
I've checked the permissions of files and folders as described in the installation docs.
What else should I be looking for?
EDIT: As suggested, I've looked in storage/logs/web.log
and this is what I get:
2019-12-05 08:35:08 [-][-][d97bb3d28a3fdd84f8c8edc795e22e6d][info][yii\db\Connection::open] Opening DB connection: mysql:host=localhost;dbname=local;port=4095;
2019-12-05 08:35:08 [-][-][d97bb3d28a3fdd84f8c8edc795e22e6d][profile begin][yii\db\Connection::open] Opening DB connection: mysql:host=localhost;dbname=local;port=4095;
2019-12-05 08:35:08 [-][-][d97bb3d28a3fdd84f8c8edc795e22e6d][profile end][yii\db\Connection::open] Opening DB connection: mysql:host=localhost;dbname=local;port=4095;
2019-12-05 08:35:08 [-][-][d97bb3d28a3fdd84f8c8edc795e22e6d][info][yii\db\Command::query] SHOW TABLES
2019-12-05 08:35:08 [-][-][d97bb3d28a3fdd84f8c8edc795e22e6d][profile begin][yii\db\Command::query] SHOW TABLES
2019-12-05 08:35:08 [-][-][d97bb3d28a3fdd84f8c8edc795e22e6d][profile end][yii\db\Command::query] SHOW TABLES
2019-12-05 08:35:09 [-][-][d97bb3d28a3fdd84f8c8edc795e22e6d][trace][yii\base\Module::getModule] Loading module: exifReturn
2019-12-05 08:35:09 [-][-][d97bb3d28a3fdd84f8c8edc795e22e6d][trace][yii\base\Application::bootstrap] Bootstrap with modules\exifreturn\ExifReturn
2019-12-05 08:35:09 [-][-][d97bb3d28a3fdd84f8c8edc795e22e6d][info][yii\web\Session::open] Session started
2019-12-05 08:35:09 [-][-][d97bb3d28a3fdd84f8c8edc795e22e6d][error][yii\web\HttpException:503] craft\web\ServiceUnavailableHttpException in /app/pb-repo/vendor/craftcms/cms/src/web/Application.php:529
Stack trace:
#0 /app/pb-repo/vendor/craftcms/cms/src/web/Application.php(187): craft\web\Application->_processInstallRequest(Object(craft\web\Request))
#1 /app/pb-repo/vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application->handleRequest(Object(craft\web\Request))
#2 /app/pb-repo/web/index.php(21): yii\base\Application->run()
#3 {main}
2019-12-05 08:35:09 [-][-][d97bb3d28a3fdd84f8c8edc795e22e6d][trace][yii\base\View::renderFile] Rendering view file: /app/pb-repo/vendor/yiisoft/yii2/views/errorHandler/exception.php
2019-12-05 08:35:09 [-][-][d97bb3d28a3fdd84f8c8edc795e22e6d][trace][yii\base\View::renderFile] Rendering view file: /app/pb-repo/vendor/yiisoft/yii2/views/errorHandler/callStackItem.php
2019-12-05 08:35:09 [-][-][d97bb3d28a3fdd84f8c8edc795e22e6d][trace][yii\base\View::renderFile] Rendering view file: /app/pb-repo/vendor/yiisoft/yii2/views/errorHandler/callStackItem.php
2019-12-05 08:35:09 [-][-][d97bb3d28a3fdd84f8c8edc795e22e6d][trace][yii\base\View::renderFile] Rendering view file: /app/pb-repo/vendor/yiisoft/yii2/views/errorHandler/callStackItem.php
2019-12-05 08:35:09 [-][-][d97bb3d28a3fdd84f8c8edc795e22e6d][trace][yii\base\View::renderFile] Rendering view file: /app/pb-repo/vendor/yiisoft/yii2/views/errorHandler/callStackItem.php
2019-12-05 08:35:08 [-][-][d97bb3d28a3fdd84f8c8edc795e22e6d][info][application] $_GET = []
$_POST = []
$_FILES = []
$_COOKIE = [
'CraftSessionId' => 'd97bb3d28a3fdd84f8c8edc795e22e6d'
]
$_SESSION = [
'bd62416aa8538ede709019a5e113eea5__flash' => []
]
$_SERVER = [
'USER' => 'www-data'
'HOME' => '/var/www'
'SCRIPT_NAME' => '/index.php'
'REQUEST_URI' => '/'
'QUERY_STRING' => ''
'REQUEST_METHOD' => 'GET'
'SERVER_PROTOCOL' => 'HTTP/1.0'
'GATEWAY_INTERFACE' => 'CGI/1.1'
'REMOTE_PORT' => '50902'
'SCRIPT_FILENAME' => '//app/pb-repo/web/index.php'
'SERVER_ADMIN' => 'webmaster@localhost'
'CONTEXT_DOCUMENT_ROOT' => '/app/pb-repo/web'
'CONTEXT_PREFIX' => ''
'REQUEST_SCHEME' => 'http'
'DOCUMENT_ROOT' => '/app/pb-repo/web'
'REMOTE_ADDR' => '172.17.0.1'
'SERVER_PORT' => '80'
'SERVER_ADDR' => '172.17.0.5'
'SERVER_NAME' => 'pb.local'
'SERVER_SOFTWARE' => 'Apache/2.4.10 (Debian)'
'SERVER_SIGNATURE' => ''
'PATH' => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
'HTTP_COOKIE' => 'CraftSessionId=d97bb3d28a3fdd84f8c8edc795e22e6d'
'HTTP_UPGRADE_INSECURE_REQUESTS' => '1'
'HTTP_ACCEPT_ENCODING' => 'gzip, deflate, br'
'HTTP_ACCEPT_LANGUAGE' => 'en-GB,en;q=0.5'
'HTTP_ACCEPT' => 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'
'HTTP_USER_AGENT' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:70.0) Gecko/20100101 Firefox/70.0'
'HTTP_CONNECTION' => 'close'
'HTTP_X_FORWARDED_PROTO' => 'https'
'HTTP_X_FORWARDED_HOST' => 'pb.local'
'HTTP_X_FORWARDED_FOR' => '192.168.95.1'
'HTTP_X_REAL_IP' => '192.168.95.1'
'HTTP_HOST' => 'pb.local'
'proxy-nokeepalive' => '1'
'HTTPS' => 'on'
'FCGI_ROLE' => 'RESPONDER'
'PHP_SELF' => '/index.php'
'REQUEST_TIME_FLOAT' => 1575534907.7596
'REQUEST_TIME' => 1575534907
'ALLOW_UPDATES' => '1'
'ALLOW_ADMIN_CHANGES' => '1'
'BACKUP_ON_UPDATE' => '0'
'DEV_MODE' => '1'
'ENABLE_TEMPLATE_CACHING' => '1'
'ENVIRONMENT' => 'dev'
'IS_SYSTEM_LIVE' => '1'
'RUN_QUEUE_AUTOMATICALLY' => '1'
'SECURITY_KEY' => '••••••••••••••••••••••••••••••••••••••••'
'SITE_NAME' => ''
'DB_DRIVER' => 'mysql'
'DB_SERVER' => 'localhost'
'DB_USER' => 'root'
'DB_PASSWORD' => '••••'
'DB_DATABASE' => 'local'
'DB_SCHEMA' => 'public'
'DB_TABLE_PREFIX' => ''
'DB_PORT' => '4095'
'ASSETS_URL' => ''
'UPLOADS_URL' => '/uploads/'
'SITE_URL' => 'https://pb.local/'
'WEB_ROOT_PATH' => '.'
'PUBLIC_PATH' => './web/'
'DEFAULT_SITE_URL' => 'https://pb.local'
]
So it seems to be connecting OK, showing tables, loading some modules, starting the session, and then returning the httpException error.
devMode
for the development environment to get more information about the error, and checkingstorage/logs/web.log
for a stack trace.web.log
.tablePrefix
(if your tables all begin with something likecraft_
, then you may need to include this in your database config /.env
.