Jump to content

Recommended Posts

Guest Geoff
Posted

Actually, the problem was that he did not own the files in his home directory [they were owned by a user id from his old server, so:

 

# chown -R rostamia .
#chgrp -R rostamia .

 

Afterwards, I needed to restore his mysql backup. I was afraid that if I restored it with root permissions, it might contain malicious code. So, instead I created a php file with the following code:

 

<?php

function SplitSQL($file, $delimiter = ';')
{
    set_time_limit(0);

    if (is_file($file) === true)
    {
           $file = fopen($file, 'r');

           if (is_resource($file) === true)
           {
            $query = array();

            while (feof($file) === false)
            {
                   $query[] = fgets($file);

                   if (preg_match('~' . preg_quote($delimiter, '~') . '\s*$~iS', end($query)) === 1)
                   {
                    $query = trim(implode('', $query));

                    if (mysql_query($query) === false)
                    {
                           echo '<h3>ERROR: ' . $query . '</h3>' . "\n";
                    }

                    else
{
                         echo '<h3>SUCCESS: ' . $query . '</h3>' . "\n";
                    }

                    while (ob_get_level() > 0)
                    {
                         ob_end_flush();
                    }

                    flush();
                }

                if (is_string($query) === true)
                {
                    $query = array();
                }
            }

            return fclose($file);
        }
    }

    return false;
}

echo 'hello';

$file = '/home1/rostamia/mysql_backup/mysql/rostamia_smf.sql';

mysql_connect('localhost', 'rostamia_smf', '****');

mysql_select_db('rostamia_smf');

echo 'hello';

SplitSQL($file);

echo 'hello';

mysql_close();

 

 

Note that I did already have that function on hand, I didn't write it just for him.

 

 

Then, I edited his config file, added the forum subdomain, and found that it was working.

 

Only have to wait 24 hours for the subdomain to be added.

Guest Geoff
Posted
Which file's that?

 

It was the SMF forum config file. I forgot it's name; maybe it was something like Configuration.php.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...