WordPress - “You do not have sufficient permissions to access this page” in production but not locally with AWS and Bedrock - wordpress

I have an installation of WordPress setup using Bedrock(https://roots.io/bedrock/) hosted on Amazon Web Services' Elastic Beanstalk. I am getting the following error when I try logging in with my admin user:
"You do not have sufficient permissions to access this page"
What's strange is that I only get this error in production. Locally everything works fine. The rest of the site also works fine in production.
I've been trying for quite a while, however none of the things I've tried seem to help. Below are some notes of what I've tried/noticed:
Did not change table prefix for database
Checked usermeta table - all the values are fine for wp_capabilities and wp_user_level
Tried creating a 'force-upgrade.php' script.
Can't access any admin pages by changing the URL (e.g wp-admin/themes.php)
The issue arose after the switch the Bedrock
Made sure the config files were identical in both environments
Any help would be much appreciated.

Check out this link for some more info https://discourse.roots.io/t/you-do-not-have-sufficient-permissions-to-access-this-page/3536/4
From the looks of it bedrock disables edits on production environments
This can be turned off by going to https://github.com/roots/bedrock/blob/master/config/environments/production.php#L14 and changing this line define('DISALLOW_FILE_MODS', true); to define('DISALLOW_FILE_MODS', false);

Related

Error - different homepage after login and after logout

Yesterday I was migrating from my "Localhost" to my new Hosting after completing (somewhat) my website.
I was migrating using the "All in one Migrating WP" plugin, and after Restoring my backup everything seemed fine.
Then some users told me that they see another homepage. I went to the website and logout, then I saw that they are right.
Some pictures in order for you to understand what I get:
At Logon Homepage
At Logon
At Logout Homepage
At Logout
Static page is set in settings to my "Elementor", everything looks like my localhost but only after logon of users. What is weirder is that I deleted the "Theme" that the page (after logout) is using, but it is still shown.
I am using Linux (ubuntu 20.04, php8.1-fpm, nginx, redis, mariadb (mysql)) and tried to restart them all after the "All in one migration plugin" did his magic.
I just can't put my hand on this problem.
Thanks for everyone in advance.
Answer: If using "Webinoly" the first thing to do is importing using the migration plugin you use, and then execute sudo site <your_site_name> -cache=off and then same again pass the 'on' argument.
restart using systemctl the nginx service.

ERR_SSL_PROTOCOL_ERROR after migrating WordPress site to another site - attempting to create staging environment

I have a site hosted on 1&1 Ionos hosting. Purchased an SSL for the site from 1&1 Ionos as well. So let's say https://www.business.com/ is what I have. Then I have another another site say http://www.mycompany.com/ hosted at the same place - still waiting for my business SSL to be approved hence the http.
So I exported the database from business.com using plugin WP Migrated DB - setting the new URL and actual filepath.
Then I imported the database into a new database for my staging environment to be hosted at http://www.mycompany.com/clients/business.
I copied ALL the wordpress files for the site http://www.business.com/ into http://www.mycompany.com/clients/business exactly except I changed wp_config.php file to reflect the new database details. i.e username, database, location and password.
So I expected http://www.mycompany.com/clients/business to be a complete replica of the original https://www.business.com/. But when I browse to http://www.mycompany.com/clients/business I get the following error:
This site can’t provide a secure connection mycompany.com sent an invalid response.
Try running Windows Network Diagnostics.
ERR_SSL_PROTOCOL_ERROR
I can't even login to the admin panel of http://www.mycompany.com/clients/business/wp-admin
Is what I tried even possible and if it is please tell me what I did wrong and how to fix it. I'd like to create a staging environment to test new themes and plugins before implementing on live environment. Critical to my original site is the aMember plugin which manages all the membership registration info. I've deleted the Really Simple SSL plugin folder from WP-Content/Plugins folder but the error remains.
Thanks in advance for any and all help and advice!
Step 1:
Check your .htaccess for rules enforcing https
Step 2:
Did you replace all links in the database? If not, you must search and replace all links from https://www.business.com/ to http://www.mycompany.com/
You can use a tool from: https://interconnectit.com/products/search-and-replace-for-wordpress-databases/comment-page-4/
Or just use command line wpcli (wp search-replace https://www.business.com http://www.mycompany.com
Step 3:
Open the new 'http://www.mycompany.com/' in a incognito tab. Browser caching might still redirect you to https.

Wordpress: attempting to update plugins results in 503 error after several minutes

I'm using wp 3.4.2 on a hosting service. I can access the ftp server and make changes using a ftp client (ie I have the correct credentials). I inherited the website and I'm trying to update everything, but as a precaution I started with the plugins.
The problem
When I try to update a plugin using the admin dashboard, after clicking "update now", the page keeps loading for several (about/at least 5) minutes. Afterwards I get a Error 503 Service Unavailable error. FTP settings are hardcoded in wp-config.php. This happens with all the plugins.
I solved it already, answer below.
In case anyone happens to stumble upon this problem, in wp-config.php the ftp host should be set to localhost instead of ftp://yourdomain.com.
Another solution i have found on my webhost was that the database user the wordpress installation used lacked the permission to refrence and to delete. Solved by giving the DB user FULL access.

How do I create a wordpress database on XAMPP server?

I created a WordPress site on phpfog, then used git to download it locally. The way phpfog is set up I can't get to the wordpress database and access it from my localhost installation. I need to set up another database. So far, I haven't been able to get it to work. Phpmyadmin won't open.
(I've also tried a new installation of Wordpress and the same thing happens)
I think the problem is that i need a database. But, where do I put it? What directory?
Here is where I'm at right now:
in the wp-config.php file, I've changed the parameters "user" to 'root' and the password to 'mypassword'
in mylini, I've changed the password param to 'mypassword' and the port to '3306'
in config.inc.php, I've changed "user" to 'root' and 'password' to ''
When I try to connect to phpmyadmin, I get this.
Error
MySQL said:
Cannot connect: invalid settings.
phpMyAdmin tried to connect to the MySQL server, and the server rejected the connection. You should check the host, username and password in your configuration and make sure that they correspond to the information given by the administrator of the MySQL server.
I've tried a number of ideas on various forums, but nothing gets me past this yet. Any ideas would be awesome.
Greg
First - It's hard to know how to answer as your question is rather vague. There's two very different things involved. First, setting up xampp. Then setting up wordpress. I couldn't quite figure out which you were referring to for each error, so here's a long winded explination/answer in case any thing helps:
Are you on Linux I presume? On windows it was a bit of a hassle and wamp was 20x easier. But, you might consider a preconfigured stack that includes xampp (and necessary includes) and a few other goodies, some come with wordpress installed. I haven't personally used them, but wish I had - google ought to help out there.
I'm assuming you went to (http://)localhost/phpmyadmin, right?
First you need to get there before you hook up wordpress. As for hooking up xampp, it does take some configuration, so make sure you follow the docs - it's not quite a one click install.
Once you have xampp setup, you need to create a new database in localhost/phpmyadmin for wordpress. Then go back to your file folders, which should be located in xampp/htdocs/yourwordpressinstall.
config.inc.php - is that your wordpress directory?
It needs to be wp-config.php (if it's not already there, save wp-config-sample.php as such). Open that, change server to localhost, database to the name of the database you just created. The username and password are the ones when you installed xampp. By default, I think they're User: Root, and PW: unset(blank). If you go to phpmyadmin there's a link to security and it'll show you there. localhost/phpmyadmin
Now, you should be able to type in the location of the filefolders.
localhost/wordpress/
- assuming your server is started, and the wordpress root folder is name "wordpress" and is in the xampp/htdocs/ folder.
From there you should see wordpress.
However, if you've exported your database, you'll need to change the site_url and home_url options to the new url. I'd suggest using the plugin wp db migrate (something like that) which will allow you to export the database from wordpress and auto set the values. Once the plugin is installed it's under the tools menu.
If you google migrating wordpress, you'll find plenty of tutorials and guides for moving wordpress from local to live, or as you're doing, online to local.
Sorry, I have to run, so I'm not sure if I really got to exactly what you needed, but that should get you started and give you the keywords to let google and other tutorials/docs get you the rest of the way.
I would recommend developing locally. That is, you develop stuff on your own machine with a dummy database. When you are happy with your changes, you upload them to your server, which works with your real (production) database.
To hook your local copy up with a database:
Install MySQL on your local machine
Open an interface to MySQL. On a UNIX-like system, you could type mysql on the command line
CREATE DATABASE ''databasename'';
GRANT ALL PRIVILEGES ON ''databasename''.* TO "''username''"#"''hostname''" IDENTIFIED BY "''password''"; (if hostname is %, you can log in from all hosts)
FLUSH PRIVILEGES;
Update your local wp-config.php with your local credentials and database name

Wordpress site not logging in

I created a site locally on my machine everything is working fine, I uploaded it to my server a couple of weeks ago for testing/client review.
Everything looked good so the site was launch. The sites been up and running fine for about a month, today I tried to login to the backend but I have'nt been able to.
I'm able to access the login page fine. I insert my username and password and the page does nothing, just refreshes the page and clears the login form. I've tried resetting my admin password using the login form and it just keeps telling my to input a username or email.
I've downloaded the entire site and database installed it locally and it runs great no issues. I've up graded the local version to 3.1.3 it was still working fine so I replaced the live version with the new files, and still no luck.
Any suggestions?
I'm still not 100% sure what caused the problem, I'm guessing something in the core wordpress install was corrupted.
I ended up installing a fresh version of wordpress, exporting and then importing my database into a new database, and uploading the media, theme, and plugins separately which seemed to do the trick.
When you have a duplicate of a site on localhost or dev server and they have the same security keys it can cause a cookie collision.
Make a change to all of the security keys in the wp-config.php file and it will reset all sessions and cookies.
Same issue for me and i already mentioned here what worked for me.
Wordpress 3.8 gives me "You must enable cookies to use WordPress." at login

Resources