Yii Framework Forum: amintado/yii2-module-wordpress - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

amintado/yii2-module-wordpress Rate Topic: -----

#1 User is offline   SteveM 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 73
  • Joined: 26-October 15
  • Location:Navan, Ireland

Posted 09 February 2018 - 06:17 AM

I'm trying to understand how this module works in order to get it to work. If I had a better understanding of auto-loading and the inner workings of Yii, I could solve this myself.

I have it configured according to the instructions:

'modules' => [
        'cms'=>[
                    'class'=> amintado\wordpress\Module::className(),
                ]
]


Then I'm instructed to open this link in order to install Wordpress: http://yourhost.com/.../index.php/cms.

Since I've removed index.php, I'm accessing it with this link: http://yourhost.com/cms/
Note that the trailing slash is needed (is this correct?). Then it runs the default controller of the module, which creates /cms in the root directory (i.e. outside of the web folder) and copies Wordpress to it. Then it runs wp-load.php with this line:

include (__DIR__.'/../../../../cms/wp-load.php');

This is the wp-load file in cms, not in the vendor directory. So far so good, until it comes to line 202 of wp-load, which attempts to redirect to /cms/wp-admin/setup-config.

    if ( false === strpos( $_SERVER['REQUEST_URI'], 'setup-config' ) ) {
        header( 'Location: ' . $path ); // $path = 'https://myhost/cms/wp-admin/setup-config.php
	exit;
    }


But this just returns a 404 not found error. And in fact anything I try to access in /cms/ returns the same error.

My question right now is, how is the module attempting to redirect to a script outside the web folder and why isn't it working?

httpdocs
|----backend

|----cms

|----wp-load.php

|----wp-admin

|----setup-config.php

|----wp-content

|----wp-includes

|----yii-config

|----common

|----frontend

1

#2 User is offline   SteveM 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 73
  • Joined: 26-October 15
  • Location:Navan, Ireland

Posted 12 February 2018 - 03:45 PM

I've managed to complete the WP setup by adding the db schema to my Yii db and configuring wp-config manually. Now the default controller shows the setup is complete:

// Module DefaultController.php
public function actionIndex()
    {
        echo 'ok;Finished';


    }


That's great! Now how do I access Wordpress? If I try https://myhost.com/cms, it just tries to direct me to site/cms. I'm still not clear on how this is supposed to run outside of the web directory.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users