The MU forums have moved to WordPress.org

Local WPMU installation and troubles with subdomains (8 posts)

  1. nig3d
    Member
    Posted 14 years ago #

    I'm using a XAMPP distribution on my local windows XP.
    I have created 2 virtual hosts for 2 different subdomains, if you wonder why I have done this, it's because I have eventually to reproduce the same environment on the production machine.
    I have then myfirstsub.domain.it and mysecondsub.domain.it.
    I have then installed a fresh version of WPMU 2.9.1 on myfirstsub.domain.it. It looks like WPMU supports it and it doesn't complain indeed.
    The blog then works properly and as admin, using the dashboard, I have created a second blog.
    Here the troubles start. First of all WPMU assumes that the blogs are always installed on a subdomain of the main blog. Right and what about if the main blog is already installed in a subdomain?
    So when I create mysecondsub, something like that is actually registered:
    mysecondsub.myfirstsub.domain.it.
    Not too bad though, since right after I changed the url still using the dashboard. After I have done it, mysecondsub.domain.it works properly, thing is, that I can't login in.
    I tried to debug, but I'm not good enough and actually I don't know which strategies are best to debug.
    Yet I think that WPMU should be more verbose on errors when things like that happen. There is something wrong with the cookie generation almost by sure, but WPMU keeps redirect me to the login page, so there is no chance to understand what is going wrong.

  2. nig3d
    Member
    Posted 14 years ago #

    Could yo please share also some suggestion about how you debug WPMU code? Do you use firephp? do you use a proper debugger? do you just trace out errors? Is there a guide about WPMU errors?

  3. frankindelicato
    Member
    Posted 14 years ago #

    Hi nig3d,
    Like you I am new to Wordpress and PHP. Started using them both about a month ago. I am an old programmer and I am lazy. Here is a not very efficient little thing I do when first learning new code: In the Wordpress file `wp-settings.php' file place a code snippet like this:

    // In the define below use something unique to you..
    // by commenting the define out your code will later be ignored
    define('FJI', '1');
    if (defined('FJI'))
    {
            // you can pass this function a variable number (up to five) arguments
            // i.e. strings, variables, etcetera.
    	function err_msg($arg1, $arg2=NULL, $arg3=NULL, $arg4=NULL, $arg5=NULL)
    	{
    		$arg = sprintf('%s %s %s %s %s', $arg1, $arg2, $arg3, $arg4, $arg5);
    		error_log($arg);
    	}
            // useful for dumping arrays. $from is your private message string it
            // usually is where the call is made from. $arr is the array you want to dump.
    	function my_array_walk($from,$arr)
    	{
    		foreach ($arr as $k => $v )
    		{
    			$data = $v;
    			err_msg($from,'$key=',$k,'$value=', $data);
    		}
    	}
    }

    Then in the code you are studying you can put lines of code in like this:

    $list = @ftp_rawlist($this->link,$path);   // Wp source code
    // your stuff
    if (defined('FJI'))err_msg('$php_errormsg=',$php_errormsg);
    if (defined('FJI'))if(empty($list))err_msg('WP_Filesystem_FTPext $list=empty');
    if (defined('FJI'))my_array_walk("calling from xxx example", $list);

    These functions will write their data out to the php_errors.log file. I just made an alias to the error log file and put it on my desktop then, when I start studying, I just pull up the log file and watch the output.
    Hope this helps, and I too need to study the new debuggers. Will have to check out firephp....

  4. nig3d
    Member
    Posted 14 years ago #

    thanks man, I will try asap!

  5. frankindelicato
    Member
    Posted 14 years ago #

    I forgot to mention that you have to have the error_log options set up in your php.ini file. I have mine set like this:

    log_errors = On
    error_log = "/Users/frankindelicato/Sites/phpMyAdmin/logs/APPLE_php_errors.log"

    I use APPLE_php_errors.log instead of the default php_errors.log because I keep two separate logs , one for an Apple server and one for a MAMP server...

    There are other error options for the php.ini file and they are discussed in the php manual here

  6. andrea_r
    Moderator
    Posted 14 years ago #

    No, you just set it up wrong.

    If you install MU in whatever TLD, subdomain or not, that is the address it will use to build the rest of the blogs from.

    It "assumes" you wanted subdomains as there is a radio button on the install screen. If you want subfolders, you pick the other one.

    The reason you can't login to the second blog, after you changed the URL, is you didn't change it in all the places it needed to be done.

    Since MU expects to create subdomains of the main (given the way you set it up) if you wanted two subdomain blogs from the one install, you'd have to set up MU in domain.it.

    If you want to mess aroudn with a different specific URL structure, you'd be better off to remap the blog URLs using the Domain Mapping plugin (look in the repo).

    Your server logs php errors. None of what you did was php related.

  7. nig3d
    Member
    Posted 14 years ago #

    thanks for both the answers.
    Just wonder how should I have been supposed to know WP limitations, since the installer doesn't complain at all about the installation and it works correctly as long as I don't login in the second blog.
    Anyway, can I ask where I'm supposed to look in order to remap all the urls? I made a search through the entire DB, just 27 tables are not much, and all the URL are correctly set up.
    To be sure, I have searched through the entire code as well, but luckily no url are directly written in the code.
    Does this domain mapping plugin do more than modify all the DB tables?
    Anyway when I talk about errors, I talk about exceptions. Isn't it an exception if the function wp_authenticate receives a null string for both username and password even if I wrote username and password in the form? I think so and at least the code should tell me that something is going wrong.
    Anyway this is not important right now, I'm actually messing up just to understand as much as I can about how PHP and WPMU code work and moreover, I can't install WPMU in the main domain, since there must run the old site of my community for a while yet.

  8. nig3d
    Member
    Posted 14 years ago #

    I read the info about the domain mapping plugin, it doesn't look like it's suitable for my purposes, but I will find the solution soon or later. If I notice that it's really a structural problem instead, I will use another domain and I will install WPMU with the suggested procedure.

About this Topic