I am starting with Appengine on GCP and recently had installed Wordpress. But when i tried to install plugins o some themes, i see a window:
Connection Information To perform the requested action, WordPress
needs to access your web server. Please enter your FTP credentials to
proceed. If you do not remember your credentials, you should contact
your web host.
I saw the post with the same issue and I add to the file php.ini:
google_app_engine.disable_readonly_filesystem = 1
and tried to deploy the app again, but doesn't work.
Does someone have wordpress on Appengine in Standard environment running without troubles ?
Best approach is to run Wordpress locally and then deploy to appengine. After lot of trials and failures, I have made these notes for my own reference, and hope these help you too. Here you can run the wordpress site on a separate service on appengine and have multiple services to run different wordpress sites. This way you need only one instance of CloudSQL which is cost effective
On GAE:
Your project ID (myGcpProjectID).
Create SQL Instance if not already exists (instance name: projectwideSQLInstance)
Do not have to create a new instance for wordpress, unless you need security and
don’t mind increased cost.
Create database (name: wordpressDatabase)
Create user and assign a pwd (user: wordpressDBUser ; user: wordpressDBUserPassword)
On your local machine:
Install Composer from https://getcomposer.org/
Run following commands in CloudShell SDK inside your work folder
composer require google/cloud-tools
vendor\bin\wp-gae create
**Answer the series of questions **
Region of SQL instance to be same as from GAE
dir: wordpressforgae (or any other name, this is just your local folder)
project_id: myGcpProjectID
sql_instance: projectwideSQLInstance
db_name: wordpressDatabase
db_user: wordpressDBUser
db_pwd: wordpressDBUserPassword
same user for local? Y
All required wordpress files will be downloaded into the folder wordpressforgae.
Open MySQL Workbench and create a schema with name wordpressDatabase (same as db_name above) on your local server
Download latest version of wordpress and extract contents to a folder named localwp
Install XAMPP (Only Apache server and PHP, Deselect all other options).
Delete the contents inside the htdocs inside XAMPP folder and Copy the contents from localwp (extracted from downloaded Wordpress.zip file).
Run wordpress using a browser with localhost in address line. It will ask you for database details. Answer as below: (Make sure these values match with what you added to CloudSQL instance in the beginning)
Server: yourlocalhost
Database name: wordpressDatabase
User: wordpressDBUser
Password: wordpressDBUserPassword
Necessary fields are added to the database and it will ask you to Enter site details along with site admin name and pwd. Enter site details here. Once everything is done and site is created, check the same by opening “localhost” in another browser, which should show a basic WP website with your site title etc. Now close both browsers.
Now delete the contents of htdocs folder inside xampp
Copy the contents from folder "wordpressforgae" (downloaded with command wp-gae create) and paste inside the htdocs folder of xampp.
Check wp-config.php to ensure these
if ($onGae) {
/** The name of the Cloud SQL database for WordPress */
define('DB_NAME', wordpressDatabase);
/** Production login info */
define('DB_HOST', ':/cloudsql/ myGcpProjectID:project_region:projectwideSQLInstance');
define('DB_USER', wordpressDBUser);
define('DB_PASSWORD', wordpressDBUserPassword);
} else {
/** The name of the local database for WordPress */
define('DB_NAME', wordpressDatabase);
/** Local environment MySQL login info */
define('DB_HOST', 'localhost');
define('DB_USER', wordpressDBUser);
define('DB_PASSWORD', wordpressDBUserPassword);
}
Now open the wordpress admin in browser with address localhost/wp-admin. Make all changes including adding/removing themes, uploading images, creating pages or anything else. Check website on another browser as you are making changes.
Uploading site to GAE:
First time, use this command to upload
gcloud app deploy app.yaml cron.yaml
If you like to create the website on a different service than default inside your Appengine add this line to app.yaml
runtime: php72
service: wordpress (can be a different name for each site)
For any subsequent minor changes made to site locally, same can be reflected on GAE by simply exporting the database from local to GAE Cloudinstance using MySQL Workbench.
Only If major changes are made to design, like new theme, add images from local machine etc deploy to GAE using
gcloud app deploy app.yaml cron.yaml
It is better to clear the bucket using this before each deploy (Make sure you have enabled delete rights using IAM - Add Role "Storage Admin" for the email ID you are using on CloudShell login to your GCP account)
gsutil -m rm gs://staging.myGcpProjectID.appspot.com/**
If you have different domains/subdomains you want to direct to each of these sites, you may do the same by adding domains to your appengine and configure dispatch.yaml file to redirect each domain/subdomain to corresponding service on appengine
Related
imported database, copied drupal site files to wamp/www folder, changed database configuration files, but got "Drupal already installed" error.
Tried by increasing packet size on mysql configuration file.While trying with an empty database , through the setup steps, site being installed. Is there any solution to use the existing database
Drupal version:8.9.20
Php: 7.4.26
apache: 2.4.51
mysql:5.7.36
This message can happen for several different reasons, so here is a start to help you trouble shoot:
MySQL max_allowed_packet, innodb_buffer_pool_size, innodb_lock_wait_timeout
Adding this to verify that this is the packet setting you updated in my.ini
Try updating the innodb_buffer_pool_size & innodb_lock_wait_timeout settings as well
Be sure to restart MySQL after the update is made
drupal.org source
Verify Permissions settings.local.php & MySQL DB user
Make sure the file permissions on your /sites/default/ folder is correct, and settings.local.php file (or whichever settings file you are using)
Make sure the DB user you have configured in the settings file has the correct permissions to the DB as well
Check log files
Check all log files in your WAMP log folder to see if there is any additional information
I have a Wordpress site with hostagator web hosting , I am buying new domain and want to use new domain for site but same existing developed site. How to backup existing site and then restore to new domain ?
Solution is here
after searching a lot i got one simple solution.
Using Duplicator plugins or any other tool is either difficult or paid.
My simple solution is as follows
Backup and download all data from public html folder
Download the SQL database associated with the wordpress site.(in phpMyadmin you will find option of export database.)
Now upload the same files of public html folder to the public html folder of new hosting.
create a database with same name and import the tables from the downloaded SQL database.(in phpMyadmin you will find option of import.)
Now check the site if the domain is not changed
If you are changing domain name too by keeping the website same you need to follow few more steps
Download and place the interconnet/it tool in public html folder and follow the steps in documentation to use this tool.
case1- you are transferring site from one domain to another
if you are transferring from abc.com to xyz.com ins search and replace tool replace abc.com string with xyz.com .
case2- if you are changing the names only in website
if you are keeping the domain same but changing name of site e.g. ABC Technologies to XYZ technologies . Then replace ABC to XYZ
You can use this tool as per your need as it is applicable for database too.
There are a lot of ways of doing that. You can search a lot of materials on Internet but I would advise you to use this tool because I used in the past and it's reliable and very straightforward.
It is called Duplicator and is a wordpress plugin solution:
https://wordpress.org/plugins/duplicator/
Consider to maintain your site active until your new site is working properly. I hope I could help you. Regards.
Just install WP migrate db plug-in in your current website. And export the database with your new URL. Then create a new database in your server and import the updated SQL file. Then edit your config.php with new database details. Finally point your new domian to this server
**should take complete backup (both files and databse) before making the above changes **
Here I will explain how to take back up manually and restore manually on another server with other domain name.
Backup: You need to take back up of site and database.
For site, you can take only back up of wp-content. It contains all data you need to resore.
STEP1 : cpanel-file manager-public html- (wp-content)- compress & save- export or
download zip file.
For database: phpmyadmin -> export databse. This gives you localhost.sql file.
These two files one .zip file and another .sql file are your back up.
(It is good to remember user id password of wordpress dashboard of this one)
Restore in another server on another domain:
After you get you new domain dns propagated on new server, open its cpanel.
Run wordpress script , see database name it is creating.
1) database restore:
MyphpAdmin->Database created by wordpress->check all tables->drop all tables.
Now your database is clean without any table.
In your loacalhost.sql file remove two piece of codes:
a)any signature like this (it should be on top)
-- phpMyAdmin SQL Dump
-- version 4.8.5
-- https://www.phpmyadmin.net/
-- Host: localhost:3306
-- Generation Time: Oct 14, 2019 at 09:45 PM
-- Server version: 5.6.45
-- PHP Version: 7.2.7
b) Code prompting creating a new database like this:
-- Database: soniasin_fitfoody
CREATE DATABASE IF NOT EXISTS soniasin_fitfoody DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;
USE soniasin_fitfoody;
-->Now, go to import and import, select your back up .sql file-> go. It will import all tables in your this database.
--> There is a database table now like wp_option, go there & edit siteurl (keep your new domain name), home (keep your new domain name) and admin email id.Very important.
Site Restoration:
1) Go to public html folder. Remove directory wp-content.
2) Import your back .zip file here and unzip.
3) You will find on wp-config.php file in public html folder, open it and update table prefix.
$table_prefix = 'wp_'; Here yo have to see what is your table prefix. Check database tables and see what prefix is in all tables. Here in this example it was 'wp_' , therefore kept it.
4) Now log in to you wordpress dashboard. It will take username of old site now and should take old password too. In case you forget password, change it and then open. Now wordpress will confirm that your database is changed, say ok and proceed.
Your site should be running on new URL now on another server.
In case of doubt, you ask me. If one want to watch any video here goes the link https://youtu.be/wROa37k_RQA.
I have a web server with ssh access where I show my customers the preview of their WordPress website. On that Server, I create a git repository for each customer (example: xyz-website.com.git). I run "git init --bare" so I have a repository. Then, I create a hook (post-receive) where I set the git-dir and working-dir. So when I create a Website locally, I can push to that repository and the Website becomes available so the customer can check it.
Problem: When the customer decides to install plugins, there will be new files on the server. My Idea was whenever I need to code something for that website, I just "git pull". Which doesnt work.
Can anyone tell my why and how to solve my problem?
Check whether the wp-content/plugins/ folder is included in your .gitignore file. If it is there, remove it.
For more information, refer this URL: https://www.digitalocean.com/community/tutorials/how-to-set-up-automatic-deployment-with-git-with-a-vps
I have recently taken my first programming project and it is with word press, I have never used it before as I have only done hard coding HTML/CSS before. My client has given me all of the files of her site, how do I run this on wordpress. I have installed wordpress and can run the test123 site but when I do the same thing on the local server with the info she gave me then I get a "Error establishing a database connection". This is surprising because all of the file folders in the info she gave me is the same as the test site (obv the content is different). She was doing it on a mac and I am on windows but I assume that hsouldn't matter. How can I fix this so I can see the site on wordpress and make the required changes that she wanted.
Thanks!
I tried changing the config file but that just gives me the setup again and not the site she has already made :(
First, create a folder into your htdocs folder with name test123
now put all the directory which one provide you by client in to test123 folder like wp-admin , wp-content ....etc
after then in new tab run this path
http://localhost/phpmyadmin/
Create a database with name something test , then import the database which one provide to you by your client , after import go to table name wp-options and change the site url http://localhost/test123 same for admin URL
Now back to your files and open wp-config.php file from your test123 folder root directory , change database name which one you recently created "test"
username set to "root" and password "blank" hostname should be "localhost"
now run path in to URL http://localhost/test123
after this if you want to login http://localhost/test123/wp-admin
then first you need to change user password with md5 strings from database wp-user table
the site will work on localhost
Here some change for wordpress project on host to other host .
in your sql file change host name example
to change
http://localhost
after change to your config file details.
installation WordPress in wamp server
first, start wamp server
click to start all services when it will work the icon will be colored green
Go to C:\wamp\www and paste WordPress folder there. You can rename the WordPress folder to anything you want for example test123
Now open a web browser and go to:
http://localhost/test123/
it will ask you for database connection error
now open the phpmyadmin as showing into create
a database and import the database
then go to you Wordpress folder test123 and find the wp-config.php file and replace your username with "root" database name you created , and password blank . now run http://localhost/test123/ once again
if not work then please come to chat box room.
I'm trying to set-up WordPress to run on Google App Engine.
I'm following the docs over here with MAMP as my local dev environment. The app runs okay through the GAE Launcher, but when I browse the localhost:PORT, I get:
Error establishing a database connection
I've tried changing the define('DB_HOST','localhost'); value to localhost:3306 (my MAMP MySQL port), 127.0.0.1, and even the socket address (:/Applications/MAMP/tmp/mysql/mysql.sock) - but I can't get past the database connection error.
I'm wondering if I have misinterpreted the instructions. I originally thought that the database name, username and password were just placeholders that one was supposed to customize, both in Step 3 (create database and user) and 4 (edit config file). But, hoping I could run it remotely on App Engine, I looked at their sample SQL they use to set up the database and they're using the generic terms (wp_user, wp_password) in their SQL stored in Cloud Storage. Does anyone know what is the correct procedure?
I'm seriously stuck. Can someone help?
Try the following:
Remove the ** from DB_NAME, DB_USER and DB_PASSWORD, i.e. use:
define('DB_NAME', 'wordpress_db');
/** MySQL database username */
define('DB_USER', 'wp_user');
/** MySQL database password */
define('DB_PASSWORD', 'wp_password');
When you create your user in MySQL, make sure you use the #localhost terminology as shown.
If all else fails, start with WordPress 3.5.1.
I found a better way of creating a database by following this video by Google Developers.
If you use MAMP, go to terminal and type
/Applications/MAMP/Library/bin/mysql --host=ipaddressOfCloudSQL -uroot -ppassword
Once you login, you can follow the rest of the instructions as follows.
I don't know if you still have this issue, but this is an issue of where the app SDK is looking for the file MYSQL sockets file (mysql.sock). I'm not sure where whether you can configure this somehow, but this worked for me since the default folder that the SDK looks for the file is /tmp:
cd /tmp
ln -s /Applications/MAMP/tmp/mysql/mysql.sock mysql.sock
If you simply link the MAMP sockets files to the one that google's app engine expects locally, it works. :)