9

I tried installing Craft 3.0 using composer (php composer.phar create-project craftcms/craft PATH)

And when I try to access the /web folder it's giving me the following error. I have tried removing the folder and installing it afresh again. I am currently using MAMP on my osx localhost.

  1. in /Applications/MAMP/htdocs/craft/vendor/craftcms/cms/src/web/Application.php at line 498

  2. in /Applications/MAMP/htdocs/craft/vendor/craftcms/cms/src/web/Application.php at line 175 – craft\web\Application::_processInstallRequest(craft\web\Request)

  3. in /Applications/MAMP/htdocs/craft/vendor/yiisoft/yii2/base/Application.php at line 386 – craft\web\Application::handleRequest(craft\web\Request)

  4. in /Applications/MAMP/htdocs/craft/web/index.php at line 21 – yii\base\Application::run()

7 Answers 7

10

Very likely it cannot connect to the database; that's typically what the 503 error is about:

https://httpstatuses.com/503

...so check the credentials in your .env file, and make sure that the version of MySQL that your website is using is the internal MAMP MySQL, and not the system-wide MySQL (if any).

This video may help you: Installing Craft CMS v3 with MAMP Pro

...and also a discussion of local development environments we had here might be of interest as well: Shootout at the Local Dev Corral

9

If you've just imported a database, it could mean your project.yaml is out of sync in your environment.

I fixed this by running the CLI command:

./craft project-config/sync
2
  • What should you do if you don't have access to the command line tools? Mar 12, 2020 at 16:16
  • You can also sync changes in the project config by visiting the control panel in your browser (usually /admin). Click the "Sync changes" button at the prompt.
    – Alex Roper
    Jun 2, 2020 at 21:52
3

For those creating a fresh install using Craft CMS Nitro and its nitro create command, don't forget to run the the Setup Wizard as a final step, as described in Step 6: Run the Setup Wizard, from the Craft Docs:

Either run the setup from the admin dashboard, which redirects to: yoursite.com/admin/install

Or you can run nitro php craft setup and complete setup from the terminal.

This will populate the database with Craft's tables & data and should address the 503 error.

1

For me, the problem was that Apaches mod_rewrite wasn't enabled and Crafts .htaccess-file was ignored while the config omitScriptNameInUrls => true was set.

Looking at the code from the stacktrace, it looks like Craft was unable to determine that the request actually was for the CP and it didn't allow the installation to start, throwing the Error and returning 503 instead.

So if your URLs don't work without index.php?p= in front of them and you're serving via Apache, chances are that you need to enable mod_rewrite and then Craft will allow you to install.

a2enmod rewrite

If this doesn't help, make sure that overriding the server-config via .htaccess is allowed for your VirtualHost. Here is an example configuration:

<VirtualHost *:80>
  ErrorLog /var/log/apache2/error.log
  CustomLog /var/log/apache2/access.log combined

  DocumentRoot /app/web

  <Directory '/app/web'>
    AllowOverride All
    Require all granted
  </Directory>
</VirtualHost>
1

I had a site where in general.php, the staging section had the 'isSystemLive' => false,

It was driving me batty why I could only see the front-end if logged in.

1

Anytime I run into this issue, it's either the database settings are incorrect or I need to run composer install, so I am posting this as an answer because I am sure I will end up back at this question trying to figure out what I didn't do right.

1
  • ./craft project-config/sync did the trick.
    – Brad
    Jan 20, 2021 at 14:29
0

I had to answer a craft prompt about db backup on /admin page before I was able to access any other pages

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.