Forum
Warning: constant(): Couldn't find constant PERCH_DB_PASSWORD
I'm trying out the demo of perch and getting the error Warning: constant(): Couldn't find constant PERCH_DB_PASSWORD in \perch-test\perch\core\lib\PerchDB_MySQL.class.php on line 44
right after putting DB creds in on the setup process.
It's running on my windows 7 WAMP localhost as virtual host perch.dev
Any idea why this might be?
Is you
perch/config
folder writable by PHP?Yeah, it's writable:
It looks like it's only writable by you. What user does your web server run as?
Thanks Drew.
It's running as nt authority\system.
I did chmod 777 the directory via GIT bash and have also reapplied permissions through the windows GUI.
Screenshot: https://bit.ly/2orLuVB
Nothing has worked though I'm afraid.
I don't think it is permissions related. I just did a test and successfully wrote to a file in /perch using a php script:
I should also add that I have a great many wordpress sites running just fine on localhost.
PHP version is 5.5.12, apache is 2.4.9 and mysql 5.6.17
I don't know anything about Windows, so I can't really advise how it should be configured. Are your config files being written?
I have finally got this working, but not without some faff.
At the point where it initially failed the config.php file existed but had not been written to, however the database had been setup with the perch tables.
I noticed that the form redirected to /perch/setup/license so I went to that page and was able to resume setup but then got the same error after entering my admin user details.
At this point the config file had been written, but an incorrect value was written for the password (which I had set as blank as using the root user):
I edited that to:
Additionally it seemed that the PERCH_ERROR_MODE was not defined anywhere so added this to the bottom of the config file (is that the right place for it?):
On re-sending the POST setup completed successfully and I was able to login to perch.
Looks to me like there's a couple of bugs there you might like to look at.
Hmm, yes, could've been the blank password that did it, or couldn't been the Windows environment. Sounds like something through the setup off and then left you in a weird state.
You don't ever need to define
PERCH_ERROR_MODE
, for example.At any rate it shouldn't be an issue for me once I've satisfied myself that perch meets my needs as I'll be building sites on my linux hosting.
I may still occasionally work on localhost for more complex stuff where xdebug is helpful, but if the project is that complex, I probably wouldn't be using perch.
I have just had a similar issue trying to setup a new local Perch 3 install.
It seems the default behaviour during setup is to set
PERCH_DB_PASSWORD
to$db_password
if an empty/blank password is provided.This process creates a set of
perch3_*
tables in the database but does not actually populate theperch3_users
table with the expected login, preventing log-in following completion. As detailed above, amending this field in theconfig.php
file and re-posting to/perch/setup/license
resolved the issue.For reference, environment is Windows 7 using XAMPP.