googlearchive / appengine-php-wordpress-starter-project

Starter project for running WordPress on Google Cloud Platform
366 stars 226 forks source link

Deploying and Using Cloud SQL #65

Closed franznoel closed 8 years ago

franznoel commented 8 years ago

I'm trying to install Wordpress using this Mac version. I was able to deploy it locally using the following settings:

    define('DB_NAME', 'db_name');
    /** Local environment MySQL login info */
    define('DB_HOST', 'localhost');
    define('DB_USER', 'root');
    define('DB_PASSWORD', 'whatever');

However, when I tried to deploy it using Cloud SQL, I can't seem to figure out the correct settings.

In the DB_HOST, I have tried the following:

I'm wondering what is the real setting because the documentation does not seem unified. Here are the documentation I read:

chrishaff commented 8 years ago

It may depend on whether you set up a first or second gen instance. I set up a second get instance and had to use :/cloudsql/project-id:region:custom-db-instance

JamesVanWaza commented 8 years ago

@fritzdenim @chrishaff I am having the same problem with the users, Unfortunately my error is that the database is not connecting. How did you solve your issue?

rickbeacham commented 8 years ago

I fixed this problem by using the first generation google cloud platform. Try Chris's solution as well. Setup another WP instance and see if using the first gen works better.

" I am having the same problem with the users," With what users are you talking about? DB connection is through APP ENGINE.

On Mon, Jul 25, 2016 at 5:33 AM, jgacuca567 notifications@github.com wrote:

@fritzdenim https://github.com/fritzdenim @chrishaff https://github.com/chrishaff I am having the same problem with the users, Unfortunately my error is that the database is not connecting. How did you solve your issue?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/GoogleCloudPlatform/appengine-php-wordpress-starter-project/issues/65#issuecomment-234940402, or mute the thread https://github.com/notifications/unsubscribe-auth/AJLO9326PB_0N6L5q3-DcMYLnYaHVXABks5qZK0ggaJpZM4JHpOr .

Green dreams sleep roughly.

JamesVanWaza commented 8 years ago

@rickbeacham @fritzdenim @chrishaff

  1. I am using 1st Generation,
  2. For the users, I have created a user for SQL, and its the same that I have locally, have you tried creating another user?
  3. Should I post, my app.yamland wp-config.php files so you can see how I have set it up?
rickbeacham commented 8 years ago

Try connecting to the Google SQL service via the command line in APP Engine. Are you able to connect? Confirm your using the correct credentials for accessing the Google SQL service.

Its possible your using the wrong USER name and password.

Yes, post the wp-config.php and app.yaml. Take out any credentials. I'll compare mine with yours.

On Tue, Jul 26, 2016 at 2:13 PM, jgacuca567 notifications@github.com wrote:

@rickbeacham https://github.com/rickbeacham @fritzdenim https://github.com/fritzdenim @chrishaff https://github.com/chrishaff

  1. I am using 1st Generation,
  2. For the users, I have created a user for SQL, and its the same that I have locally, have you tried creating another user?
  3. Should I post, my app.yamland wp-config.php files so you can see how I have set it up?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/GoogleCloudPlatform/appengine-php-wordpress-starter-project/issues/65#issuecomment-235405174, or mute the thread https://github.com/notifications/unsubscribe-auth/AJLO93SRBQKQTPkxtHFQ0VZcmXe8MVquks5qZnh8gaJpZM4JHpOr .

Green dreams sleep roughly.

JamesVanWaza commented 8 years ago

@rickbeacham Below is my wp-config.php and app.yaml file Please check your email and see what I missed.

rickbeacham commented 8 years ago

Default MySQL users

When you create a new Cloud SQL instance, it has two default user accounts: ''@'localhost' and 'root'@'localhost'. Applications running on Google App Engine use the 'root'@'localhost' account. The root user account

You configure the root user account for a new instance so you can access the instance. For simplicity, the root user account is configured to connect from any host:

'root'@'%'

Unlike a standalone MySQL instance, the root user does not have SUPER and FILE privileges.

For help with configuring the root user account, see Configuring the root user account https://cloud.google.com/sql/docs/create-manage-user-mysql#user-root. For more information about MySQL privileges, seePrivileges Provided by MySQL https://dev.mysql.com/doc/refman/5.6/en/privileges-provided.html.

On Wed, Jul 27, 2016 at 11:39 AM, jgacuca567 notifications@github.com wrote:

@rickbeacham https://github.com/rickbeacham Below is my wp-config.php and app.yaml file Please check your email and see what I missed.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/GoogleCloudPlatform/appengine-php-wordpress-starter-project/issues/65#issuecomment-235679569, or mute the thread https://github.com/notifications/unsubscribe-auth/AJLO90VBxBnOxR5LNIyURZKjaP8HvYSzks5qZ6XggaJpZM4JHpOr .

Green dreams sleep roughly.

rickbeacham commented 8 years ago

Please follow the https://cloud.google.com/sql/docs/phpmyadmin-on-app-engine guide. If you are able to connect then there is something wrong with WP.

On Wed, Jul 27, 2016 at 1:04 PM, Rick Beacham beacham.rick@gmail.com wrote:

Default MySQL users

When you create a new Cloud SQL instance, it has two default user accounts: ''@'localhost' and 'root'@'localhost'. Applications running on Google App Engine use the 'root'@'localhost' account. The root user account

You configure the root user account for a new instance so you can access the instance. For simplicity, the root user account is configured to connect from any host:

'root'@'%'

Unlike a standalone MySQL instance, the root user does not have SUPER and FILE privileges.

For help with configuring the root user account, see Configuring the root user account https://cloud.google.com/sql/docs/create-manage-user-mysql#user-root. For more information about MySQL privileges, seePrivileges Provided by MySQL https://dev.mysql.com/doc/refman/5.6/en/privileges-provided.html.

On Wed, Jul 27, 2016 at 11:39 AM, jgacuca567 notifications@github.com wrote:

@rickbeacham https://github.com/rickbeacham Below is my wp-config.php and app.yaml file Please check your email and see what I missed.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/GoogleCloudPlatform/appengine-php-wordpress-starter-project/issues/65#issuecomment-235679569, or mute the thread https://github.com/notifications/unsubscribe-auth/AJLO90VBxBnOxR5LNIyURZKjaP8HvYSzks5qZ6XggaJpZM4JHpOr .

Green dreams sleep roughly.

Green dreams sleep roughly.

JamesVanWaza commented 8 years ago

@rickbeacham I have sent you my logs file, so are you saying that only the root user can be used or I cannot create another user?

rickbeacham commented 8 years ago

The root user should be able to connect to the mysql Admin and connect to all DBs. The other user might not have the correct credentials for the WordPress DB.

rickbeacham commented 8 years ago

Make sure the DB user has the correct credentials. http://localhost/phpmyadmin/server_privileges.php or check via command line.

franznoel commented 8 years ago

Thank you @chrishaff. It definitely worked for First Generation. :/cloudsql/project-id:region:sql-db-instance-name

Also, I made sure that db_name is correct. username is 'root' password is ''.

Closing this ticket.

JamesVanWaza commented 8 years ago

@fritzdenim, @rickbeacham @chriselliott

I was able to install phpMyAdmin locally, the only challenge I am having at the moment is that for the Wordpress site, is coming up as a blank page, no errors are being shown. Any idea on how i can fix that?

rickbeacham commented 8 years ago

The wordpress site is coming up blank on your local dev machine? What databases are shown in phpmyadmin on your local machine?

Try recording the logs from your development server for app engine https://cloud.google.com/appengine/docs/python/tools/using-local-server there might be some useful information there.

dev_appserver.py --persist_logs your-app-directory

https://cloud.google.com/appengine/docs/python/logs/#Python_The_development_server_and_Logs_API

On Sun, Jul 31, 2016 at 12:52 PM, jgacuca567 notifications@github.com wrote:

@fritzdenim https://github.com/fritzdenim, @rickbeacham https://github.com/rickbeacham

I was able to install phpMyAdmin locally, the only challenge I am having at the moment is that for the Wordpress site, is coming up as a blank page, no errors are being shown. Any idea on how i can fix that?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/GoogleCloudPlatform/appengine-php-wordpress-starter-project/issues/65#issuecomment-236452714, or mute the thread https://github.com/notifications/unsubscribe-auth/AJLO90YufnHMHxi1LC89VtkrJAwxgKn_ks5qbPz7gaJpZM4JHpOr .

Green dreams sleep roughly.

JamesVanWaza commented 8 years ago

@rickbeacham This is the error I am getting from my GoogleCloudLauncher, see screenshot below.

Says that Database is locked

screen shot 2016-07-31 at 7 27 10 pm
franznoel commented 8 years ago

@ jgacuca567 You can also use MySQL Workbench. Connect with IPv4. Then, make sure to create a username and password and use it.

phpMyAdmin is a client for MySQL. MySQL Workbench works better because you don't have to login or find the correct URL to connect. With the right configuration, after installng the app, you can just click on the database you want.

JamesVanWaza commented 8 years ago

@fritzdenim locally and on Google Cloud I am able to see phpmyadmin, the only issue is the wordpress installation. is there any video tutorial that you know would help, how did you do your wordpress installation?

franznoel commented 8 years ago

@jgacuca567 You might have probably used the Google Cloud Launcher to install Wordpress. This thread may be off topic if that's the case because this is not Google Cloud Launcher. The discussion is about Google App Engine using Wordpress, but let me answer your question.

The first thing is to check your IP address in your VM Instance in Google Compute Engine. Then, on your DNS setting (could be Godaddy or any DNS server), you should change the A record (with an at symbol) of your domain to your IP address.

To check your IP Address, Go to you Google API Console > Google Cloud Platform > Compute Engine > VM Instance

JamesVanWaza commented 8 years ago

@fritzdenim, I did not use Compute Engine, I used App Engine, as per the link below, what did you use to set yours up? https://github.com/GoogleCloudPlatform/appengine-php-wordpress-starter-project shows the example using App Engine

franznoel commented 8 years ago

I just probably saw the message that says the following, which lead me to conclude that you were using Google Cloud Launcer.

This is the error I am getting from my GoogleCloudLauncher, see screenshot below.

However, I did not see the logs.

Continuing, though, which SQL platform did you use? Did you also use Google Cloud SQL? If you did, is it First Generation or Second Generation?

If you used First Generation, follow this: https://wp.gaeflex.ninja/2016/04/07/running-wordpress-on-app-engine-standard-environment/ Make sure that your Wordpress works first in your local system using Google App Engine Launcher. The database should come from your local IP Address (setting it from wp-config.php of the root, not wordpress folder)

If you used Second Generation, follow this: https://cloud.google.com/php/tutorials/wordpress-app-engine-flexible

There may not be a video for this (unless you create one. It would help the community a lot).

JamesVanWaza commented 8 years ago

@fritzdenim I used First Generation, I shall review the link you sent me then inform you how it goes.

JamesVanWaza commented 8 years ago

@fritzdenim @rickbeacham

I was able to follow instructions from the link you sent me https://wp.gaeflex.ninja/2016/04/07/running-wordpress-on-app-engine-standard-environment/

I believe I did everything right, but when I got to load localhost:8000 on the browser, the page keeps reloading, however there are no errors that display. I have been unable to do the actual installation page. Did this happen to you?

rickbeacham commented 8 years ago

Please check your /etc/hosts file. Make sure localhost --- > 127.0.0.1 Can you look at the logs afterwards in app engine?

On Mon, Aug 8, 2016 at 9:00 AM, jgacuca567 notifications@github.com wrote:

@fritzdenim https://github.com/fritzdenim @rickbeacham https://github.com/rickbeacham

I was able to follow instructions from the link you sent me https://wp.gaeflex.ninja/2016/04/07/running-wordpress-on- app-engine-standard-environment/

I believe I did everything right, but when I got to load localhost:8000 on the browser, the page keeps reloading, however there are no errors that display. I have been unable to do the actual installation page. Did this happen to you?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/GoogleCloudPlatform/appengine-php-wordpress-starter-project/issues/65#issuecomment-238283672, or mute the thread https://github.com/notifications/unsubscribe-auth/AJLO99-v3idVzQ2YulZgn2lRKU4TDskpks5qd1KagaJpZM4JHpOr .

Green dreams sleep roughly.

franznoel commented 8 years ago

@jgacuca567 I haven't had the experience that it keeps on reloading when I used localhost:8000. However, if you'll check wp-config.php, you can also make sure that your local MySQL can be accessed from your local machine. If it does you may set the configuration and see if you can see Wordpress.

After that, set the Cloud SQL and deploy.

Please make sure that you have the current installation version of GAE.

rickbeacham commented 8 years ago

What OS are you on? Please try uninstalling App Engine.. Your localhost:8000 is incorrect. Make sure you are pointing to the correct port. It could be localhost:8080.

On Tue, Aug 9, 2016 at 4:48 PM, Rick Beacham beacham.rick@gmail.com wrote:

Please check your /etc/hosts file. Make sure localhost --- > 127.0.0.1 Can you look at the logs afterwards in app engine?

On Mon, Aug 8, 2016 at 9:00 AM, jgacuca567 notifications@github.com wrote:

@fritzdenim https://github.com/fritzdenim @rickbeacham https://github.com/rickbeacham

I was able to follow instructions from the link you sent me https://wp.gaeflex.ninja/2016/04/07/running-wordpress-on-app -engine-standard-environment/

I believe I did everything right, but when I got to load localhost:8000 on the browser, the page keeps reloading, however there are no errors that display. I have been unable to do the actual installation page. Did this happen to you?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/GoogleCloudPlatform/appengine-php-wordpress-starter-project/issues/65#issuecomment-238283672, or mute the thread https://github.com/notifications/unsubscribe-auth/AJLO99-v3idVzQ2YulZgn2lRKU4TDskpks5qd1KagaJpZM4JHpOr .

Green dreams sleep roughly.

Green dreams sleep roughly.

rickbeacham commented 8 years ago

Do you have another webserver running? apache or NGINX? If so stop the service.

I'm deploying a wordpress site for a client tonight. I'll let you know if I have the same problem. Are you sure the App Engine Web Server is running?

It could be simply that your directory has the incorrect permissions. You should be able to correctly test on your localhost before deploying to App Engine.

To run WordPress locally on Windows and OS X, you can use the Launcher https://developers.google.com/appengine/downloads#Google_App_Engine_SDK_for_PHP by going to File > Add Existing Project or you can run one of the commands below.

On Mac and Windows, the default is to use the PHP binaries bundled with the SDK:

$ APP_ENGINE_SDK_PATH/dev_appserver.py path_to_this_directory

define( 'WP_SITEURL', 'http://localhost:8080/');

On Tue, Aug 9, 2016 at 4:51 PM, Franz Noel notifications@github.com wrote:

I haven't had the experience that it keeps on reloading when I used localhost:8000. However, if you'll check wp-config.php, you can also make sure that your local MySQL can be accessed from your local machine. If it does you may set the configuration for Cloud SQL, and deploy them online.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/GoogleCloudPlatform/appengine-php-wordpress-starter-project/issues/65#issuecomment-238727494, or mute the thread https://github.com/notifications/unsubscribe-auth/AJLO9_uolBKLwkKVBUXaCU39lY2QmG0oks5qeRKNgaJpZM4JHpOr .

Green dreams sleep roughly.

JamesVanWaza commented 8 years ago

@rickbeacham I am on OS X El Capitan I am using MAMP PRO, does that affect the problem or ? My Localhost is at 8080

@fritzdenim the problem is that the site is not opening locally.

rickbeacham commented 8 years ago

Please go to 'GoogleAppEngineLauncher' Click run for the wordpress application.

Now go to http://localhost:8000 in your browser.

Click on logs icon in the GoogleAppEngineLauncher. What does it say? Here is an example of mine. Notice, mine is a little out of date.

*** Running dev_appserver with the following flags:

Python command: /usr/bin/python2.7

INFO 2016-08-10 16:54:21,268 devappserver2.py:769] Skipping SDK update check.

_WARNING 2016-08-10 16:54:21,328 simple_search_stub.py:1126] Could not read search indexes from /var/folders/5l/s27q8k9d5pl9683m8rzz38bw0000gn/T/appengine.rickbeacham-wordpress.splitline/searchindexes

_INFO 2016-08-10 16:54:21,331 apiserver.py:205] Starting API server at: http://localhost:53571 http://localhost:53571

INFO 2016-08-10 16:54:21,336 dispatcher.py:197] Starting module "default" running at: http://localhost:8080 http://localhost:8080

_INFO 2016-08-10 16:54:21,338 adminserver.py:116] Starting admin server at: http://localhost:8000 http://localhost:8000

INFO 2016-08-10 16:55:50,791 module.py:787] default: "GET / HTTP/1.1" 500 4371

INFO 2016-08-10 16:55:50,859 module.py:787] default: "GET /favicon.ico HTTP/1.1" 404 -

INFO 2016-08-10 16:55:50,968 module.py:401] [default] Detected file changes:

INFO 2016-08-10 17:00:35,968 module.py:787] default: "GET / HTTP/1.1" 200 7679

INFO 2016-08-10 17:00:35,982 module.py:787] default: "GET /wp-content/themes/twentyfourteen/style.css?ver=3.9.1 HTTP/1.1" 200 75703

INFO 2016-08-10 17:00:35,982 module.py:787] default: "GET /wp-content/themes/twentyfourteen/genericons/genericons.css?ver=3.0.2 HTTP/1.1" 200 22680

INFO 2016-08-10 17:00:35,983 module.py:787] default: "GET /wp-includes/js/jquery/jquery-migrate.min.js?ver=1.2.1 HTTP/1.1" 200 7200

INFO 2016-08-10 17:00:35,983 module.py:787] default: "GET /wp-content/themes/twentyfourteen/js/functions.js?ver=20140319 HTTP/1.1" 200 3393

INFO 2016-08-10 17:00:35,983 module.py:787] default: "GET /wp-includes/js/jquery/jquery.js?ver=1.11.0 HTTP/1.1" 200 96402

On Wed, Aug 10, 2016 at 6:11 AM, jgacuca567 notifications@github.com wrote:

@rickbeacham https://github.com/rickbeacham I am using MAMP PRO, does that affect the problem or ? My Localhost is at 8080

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/GoogleCloudPlatform/appengine-php-wordpress-starter-project/issues/65#issuecomment-238861589, or mute the thread https://github.com/notifications/unsubscribe-auth/AJLO9yB0nfg9iUjutMp8x99Z-CsTr8B0ks5qec3kgaJpZM4JHpOr .

Green dreams sleep roughly.

JamesVanWaza commented 8 years ago

@rickbeacham @fritzdenim

This is the screenshot for my logs file, still unable to connect to the db

screen shot 2016-08-10 at 1 51 53 pm
rickbeacham commented 8 years ago

Your wp-config.php file is using the version from Google's Github starter project?

https://github.com/GoogleCloudPlatform/appengine-php-wordpress-starter-project/blob/master/wp-config.php

Use root in wp-config for now.

On Wed, Aug 10, 2016 at 10:52 AM, jgacuca567 notifications@github.com wrote:

This is the screenshot for my logs file, still unable to connect to the db

[image: screen shot 2016-08-10 at 1 51 53 pm] https://cloud.githubusercontent.com/assets/4000076/17564538/a78ad3b6-5f01-11e6-80a6-5b154a408c79.png

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/GoogleCloudPlatform/appengine-php-wordpress-starter-project/issues/65#issuecomment-238947993, or mute the thread https://github.com/notifications/unsubscribe-auth/AJLO91HTbRsy_LbdgsLhNrVQeZI-Ig9Jks5qeg_qgaJpZM4JHpOr .

Green dreams sleep roughly.

JamesVanWaza commented 8 years ago

@rickbeacham @fritzdenim

Yes, the only thing that I have changed is the host to match the project id.

See Updated Config Image

screen shot 2016-08-10 at 4 29 30 pm

Can I send you my config file?