Forum

Thread tagged as: Problem, Installation, Configuration

Invalid license key when running locally

I'm trying to setup perch locally and i'm getting this error at login:

"Sorry, your license key isn't valid for this domain. Log into your Perch account and add the following as your live or testing domain: mysite.local"

I'm running this via MAMP Pro.

Config file:

    define('PERCH_LICENSE_KEY', '');

   define("PERCH_DB_USERNAME", 'root');
   define("PERCH_DB_PASSWORD", '');
   define("PERCH_DB_SERVER", "127.0.0.1");
   define("PERCH_DB_DATABASE", "mysite_local");
   define("PERCH_DB_PREFIX", "perch3_");

    define('PERCH_TZ', 'UTC');

    define('PERCH_EMAIL_FROM', 'myemail@domain.com');
    define('PERCH_EMAIL_FROM_NAME', 'John Doe');

    define('PERCH_LOGINPATH', '/perch');
    define('PERCH_PATH', str_replace(DIRECTORY_SEPARATOR.'config', '', __DIR__));
    define('PERCH_CORE', PERCH_PATH.DIRECTORY_SEPARATOR.'core');

    define('PERCH_RESFILEPATH', PERCH_PATH . DIRECTORY_SEPARATOR . 'resources');
    define('PERCH_RESPATH', PERCH_LOGINPATH . '/resources');

    define('PERCH_HTML5', true);
David Powell

David Powell 0 points

  • 3 years ago
Duncan Revell

Duncan Revell 78 points
Registered Developer

If installing locally, you still need to have a licence key in config.

During the setup, if you select "install locally", a key should be automatically generated in your config file.

During the setup, if you select "install locally", a key should be automatically generated in your config file.

One wasn't generated and I've tried reinstalling multiple times...

Drew McLellan

Drew McLellan 2638 points
Perch Support

Which version of Perch, and which version of PHP?

Duncan Revell

Duncan Revell 78 points
Registered Developer

Ah, MAMP Pro - there seems to be an issue installing Perch where the database password is blank - can you set a password for root or use a different user with a password? I'm not an expert with MAMP unfortunately...

This actually happened with me trying to get around a Perch bug:

  • My database doesn't have a password, just a username
  • If I provide that info to Perch it generates the config file but uses "$dbpassword" as the database password and errors out
  • Clearing out my config file and removing $dbpassword from the setup/config/perch.sample.php file and rerunning setup installs my tables
  • This however prevents perch from creating a local key

To do all of this I had to:

  • Remove $dbpassword from the perch.sample.php file so I can provide nothing as the password
  • Run setup to create my tables
  • Put $dbpassword back in the file
  • Clear my config file
  • Run setup again (and get a database connect error)
  • Remove $dbpassword from my config file so the database can connect
  • Go to mysite.local/perch so I can login

The first phase creates my tables but not the key. The second phase creates the key.

Drew McLellan

Drew McLellan 2638 points
Perch Support

You need to set a password on your database user account if you want to install Perch. There's no other supported configuration.