Hot answers tagged

15

I gave everything a try, but the only thing that worked for me was ensuring "Allow network access to MySQL" was ticked in MAMP. Screenshot: http://c42.co/Ur30EJ


14

After playing with this a little further it seems the unixSocket setting is necessary to get this working so I added: 'unixSocket' => getenv('DB_SOCKET') To config/db.php and then added: DB_SOCKET="/Applications/MAMP/tmp/mysql/mysql.sock" To my .env file. After that, the installation will go through using the CLI. Perhaps there's still an option that ...


6

Have you tried running ./craft setup to double check if your setup is correct? If ./craft setup completes successfully ./craft should find the existing installation and complete any required setup. In my experience, this is usually related to a non-default /config/db.php or problematic .env file. Note: Always do a backup before trying anything related ...


5

You can get this error message even if Craft installation is OK. If you work in MAMP environment and have this error message, check if your PHP and MySQL are available from command line (Terminal). To check PHP, do following: Open terminal and type: $ which php If you see something like "/usr/bin/php" that means MAMP's PHP is not available from command ...


3

This just launches PHP's built in web server, documentation for it can be found here: https://www.php.net/manual/en/features.commandline.webserver.php You can use php -s localhost:8000 instead You can see available settings by running php -s Yes you can run multiple versions on different ports Hope this helps!


3

Craft-Scripts will do this for you: https://github.com/nystudio107/craft-scripts#clear_cachessh You can see what it does via the source: https://github.com/nystudio107/craft-scripts/blob/master/scripts/clear_caches.sh As for cache/clear this clear's Yii2's cache... which Craft CMS uses for almost nothing. Template Caches are always in the db, compiled ...


3

Alternatively, you could write your own yiic shell wrapper for each environment that defined CRAFT_ENVIRONMENT. Something like yiicstaging: #!/usr/bin/env php <?php define('CRAFT_ENVIRONMENT', 'staging') require_once('path/to/craft/app/etc/console/yiic.php');


2

For anyone from the future, this worked for me utilizing Ubuntu 16.0.4 with PHP7.2: Try this command: sudo phpenmod pdo_mysql If it says it cant find the package, install this: sudo apt-get install php7.2-mysql Check your active php.ini file for this line(my active .ini was located n /etc/php/7.2/apache2/php.ini): ;extension=pdo_mysql If it has a ...


2

This ended up being a bug in Craft that was fixed in https://github.com/craftcms/cms/commit/df40f585cef3d7e47f811f73b08d9d71bbc9c9b2 and will be included in the next (3.3.14) release.


2

queue/run - should be used if you're going to manually execute this command via a cron job or such, because it runs any pending queue jobs, then exits queue/listen - should be used if you want it to constantly poll (with a reasonable cooldown interval) for new jobs, and run them, because it runs a listen process that spawns a sub-process to run queue jobs as ...


2

Thank you @Brandon Kelly for the solution: That’s because @webroot is only reliable on web requests. To fix, update your resourceBasePath config setting to a real path: 'resourceBasePath' => dirname(__DIR__) . '/web/cpresources'


1

How does craft know which migrations have been applied and which are new? I.e. Is it by comparing the craft_migrations table to the migration files found in '/vendor/craftcms/cms/src/migrations' folder (or plugin folders)? Exactly! Where does the information from running 'php craft migrate/new' and 'php craft migrate/history' come from? migrate/history ...


1

Yes, looks like you'll need to look at the folder yiisoft and subfolders for permissions. Maybe set them to read, write until you're done and then change them to read only. Just thinking off the top of my head about what the issue could be.


1

This is something I completely overlooked, but the Craft CLI is just a PHP wrapper that's executable on the CLI. So this will work: /usr/bin/php73 craft help or /usr/bin/php73 craft update all Will run the CLI with the PHP binary of your choice.


1

Sounds like you don't have the correct PHP loading in your CLI. You should try using MAMP’s PHP Executable in your Terminal.


1

Explanation for answer Since the craftcms supplied CLI file aka ./craft uses the following to identify it's location: // Set path constants define('CRAFT_BASE_PATH', __DIR__); // the above finds out the file path where the ./craft file is stored in There's no need for any cd commands in your crontab, so all you have to do, is make sure that you either have ...


1

Fully detailed video on how to install Craft with Scotchbox is here: https://craftquest.io/courses/localhosting-craft-cms/4312 Missing step is SSHing into vagrant box


1

The default database name created by Scotchbox is scotchbox, not Craft, and the DB Password is root. You can find the DB connection details in the Scotchbox Docs.


1

This is all very specific to the box you're using, and how it's configured. I realize Scotch Box is a historically popular setup; you might also consider Homestead as it is geared specifically for PHP development. Anyway, according to the Scotch Box docs the setup should be: Database Host: localhost Database User: root Database Password: root Which I ...


1

Jason Mayo's strategy of changing localhost to 127.0.0.1 in .env file worked for me as well 👍🏻 (MAMP Pro v6 on Mac OS 11.4 Big Sur)


Only top voted, non community-wiki answers of a minimum length are eligible