XF 1.2 Help Moving Xenforo to Amazon Web Services

XnForFanKN

Active member
Hello,

I am moving a website that uses both WordPress 4.1.1 and Xenforo 1.2.7 to a new server. The main part of the site uses WordPress, but there is also a discussion forum that uses Xenforo. They are both part of the same domain. The site is Bridged by XenScript's XenForo to Wordpress Bridge. I am moving the entire site from its current server to a server (instance) on the Amazon Web Services with Bitnami. I am having a couple of problems.

This is what I've done so far.

1. The first thing I did was make a backup of the current live site's databases and files. I created a .sql backup of both the WordPress and Xenforo database, and a .tar backup of the files. I used PuTTY to create these backups.

2. I downloaded those backup files from step 1 to a flash drive, so that they would be ready to upload to the Amazon server. I also, separately, downloaded a copy of the wp-config.php file for WordPress and the config.php file for Xenforo. Those files will need to be edited later on, so I wanted to have a separate copy of them.

3. On the new Amazon server, I created a database for both WordPress and for Xenforo.

4. From my flash drive, I opened up the wp-config.php and config.php files and put in the new database and server details for the Amazon/Bitnami instance.

5. Next, I uploaded the .sql database files and the .tar file to the main directory of the Amazon server.

6. I ran the commands to restore the backups of the databases into the newly-created, empty databases. Then I ran the command to untar the backup of the files into the main web root directory.

7. I then uploaded my revised versions of the wp-config.php and config.php files to the Amazon server, replacing the old versions.

8. I then gave the uploads directory in WordPress 777 permissions.

I have not made any DNS changes yet, because I want to make sure the site is working on the new server before I do that.

The WordPress end of the site seems to be working decently okay on the Amazon server. There are some problems, but as this is the Xenforo support forum, I will ask the WordPress questions elsewhere. As far as the Xenforo part is concerned, I am getting an error message when trying to load that part of the site in my browser. The error message displayed in Chrome is "An unexpected error occurred. Please try again later." The error message displayed in IE is:

"The website cannot display the page

Most likely causes:

The website is under maintenance.

The website has a programming error."


Looking at what I've done in my eight steps above, have I missed something? How can I get the Xenforo part of the site to load?

Any help would me much appreciated. Thank you!
 
In terms of the XF error, add this to library/config.php:
Code:
$config['debug'] = true;
That should display a more detailed error then. (Remove it when done debugging.)
 
If you view the page source does it show any additional information (unlikely but it's worth a try)?

I just tried that now, but it didn't bring anything different up. Thanks, though.


In terms of the XF error, add this to library/config.php:
Code:
$config['debug'] = true;
That should display a more detailed error then. (Remove it when done debugging.)

Thanks. This is what it said:

An exception occurred: unserialize(): Error at offset 245 of 15618 bytes in /opt/bitnami/apache2/htdocs/public_html/community/library/XenForo/Dependencies/Public.php on line 308

1. XenForo_Application::handlePhpError()

2. unserialize() in XenForo/Dependencies/Public.php at line 308

3. XenForo_Dependencies_Public->preRenderView() in XenForo/FrontController.php at line 561

4. XenForo_FrontController->renderView() in XenForo/FrontController.php at line 158

5. XenForo_FrontController->run() in /opt/bitnami/apache2/htdocs/public_html/community/index.php at line 13
 
That would seem to imply there were issues with the database dump and/or transfer to the new server. Ideally, you'll need to make a fresh database dump using mysqldump, zip it up, and then transfer it over to the new server.
 
That would seem to imply there were issues with the database dump and/or transfer to the new server. Ideally, you'll need to make a fresh database dump using mysqldump, zip it up, and then transfer it over to the new server.

Thank you for your reply. I did another database backup and move, as well as several other things, and now I'm getting a different error message:

An exception occurred: include(/home/directory/domains/website/public_html/wp-content/plugins/placements/placement_300x250.inc): failed to open stream: No such file or directory in /opt/bitnami/apache2/htdocs/weblog/community/library/adTags/Listener300x250.php on line 6

1. XenForo_Application::handlePhpError() in adTags/Listener300x250.php at line 6
2. adTags_Listener300x250::render_adTags() in adTags/Listener300x250.php at line 6
3. adTags_Listener300x250::render_adTags()
4. call_user_func() in WidgetFramework/WidgetRenderer/Callback.php at line 56
5. WidgetFramework_WidgetRenderer_Callback->_render() in WidgetFramework/WidgetRenderer.php at line 677
6. WidgetFramework_WidgetRenderer->render() in WidgetFramework/Core.php at line 396
7. WidgetFramework_Core->_renderWidgetsFor() in WidgetFramework/Core.php at line 313
8. WidgetFramework_Core->renderWidgetsFor() in WidgetFramework/Listener.php at line 126
9. WidgetFramework_Listener::template_post_render()
10. call_user_func_array() in XenForo/CodeEvent.php at line 58
11. XenForo_CodeEvent::fire() in XenForo/Template/Abstract.php at line 195
12. XenForo_Template_Abstract->render() in XenForo/Template/Public.php at line 110
13. XenForo_Template_Public->render() in XenForo/ViewRenderer/HtmlPublic.php at line 119
14. XenForo_ViewRenderer_HtmlPublic->renderContainer() in XenForo/FrontController.php at line 614
15. XenForo_FrontController->renderView() in XenForo/FrontController.php at line 158
16. XenForo_FrontController->run() in /opt/bitnami/apache2/htdocs/weblog/community/index.php at line 13

My first question, of course, what exactly does this error mean? I am also getting template errors, in addition to that.

My second question: Just as general background info, I've been trying to find a good guide for moving Xenforo to Amazon EC2. I haven't been able to find one. I did find several guides for moving WordPress to Amazon EC2, and I've been following the general process since the site uses both WordPress and Xenforo. I found some particularly useful info on this site:

http://techredefined.com/2015/02/migrate-wordpress-blog-to-ec2/

The part that really helped with WordPress was how to change the URLs in the database. The site suggested running the following SQL queries:

UPDATE wp_options SET option_value = replace(option_value, 'http://yourdomain', 'http://your-elastic-ip') WHERE option_name = 'home' OR option_name = 'siteurl';

UPDATE wp_posts SET guid = replace(guid, 'http://yourdomain','http://your-elastic-ip');

UPDATE wp_posts SET post_content = replace(post_content, 'http://yourdomain', 'http://your-elastic-ip');

I ran them, and that solved some of the WordPress problems. I was wondering what the equivalent of these would be for Xenforo. Basically, what SQL queries can I run on the Xenforo database to allow me to test the website on Amazon EC2 before making the DNS changes?

Thank you!
 
An exception occurred: include(/home/directory/domains/website/public_html/wp-content/plugins/placements/placement_300x250.inc): failed to open stream: No such file or directory in /opt/bitnami/apache2/htdocs/weblog/community/library/adTags/Listener300x250.php on line 6
This is related to an add-on -- one involving ad tags it seems. You'll need to contact the author for guidance.

I ran them, and that solved some of the WordPress problems. I was wondering what the equivalent of these would be for Xenforo. Basically, what SQL queries can I run on the Xenforo database to allow me to test the website on Amazon EC2 before making the DNS changes?
The only place there are full URLs in XenForo are within the posts themselves (when a user made an internal link). You can do similar queries on the xf_post table, but if you're just doing basic testing, it's really unnecessary.

You can update the "Board URL" option to point to your new testing location, though even that is only really used when sending email.
 
This is related to an add-on -- one involving ad tags it seems. You'll need to contact the author for guidance.


The only place there are full URLs in XenForo are within the posts themselves (when a user made an internal link). You can do similar queries on the xf_post table, but if you're just doing basic testing, it's really unnecessary.

You can update the "Board URL" option to point to your new testing location, though even that is only really used when sending email.
Thank you very much for your reply. It is really just basic testing. I was able to log in to the Xenforo Admin Control Panel. The sections are available, but the following message is displaying at the top.

Template Errors: home

1. include(/home/directory/domains/website/public_html/wp-content/plugins/placements/placement_300x250.inc): failed to open stream: No such file or directory in /opt/bitnami/apache2/htdocs/weblog/community/library/adTags/Listener300x250Albums.php, line 8:
7: </p>
8: ';
9: }

2. include(): Failed opening '/home/directory/domains/website/public_html/wp-content/plugins/placements/placement_300x250.inc' for inclusion (include_path='/opt/bitnami/apache2/htdocs/weblog/community/library:.:.:/opt/bitnami/php/lib/php:/opt/bitnami/frameworks/smarty/libs') in /opt/bitnami/apache2/htdocs/weblog/community/library/adTags/Listener300x250Albums.php, line 8:
7: </p>
8: ';
9: }

3. include(/home/directory/domains/website/public_html/wp-content/plugins/placements/placement_300x250.inc): failed to open stream: No such file or directory in /opt/bitnami/apache2/htdocs/weblog/community/library/adTags/Listener300x250Albums.php, line 8:
7: </p>
8: ';
9: }

4. include(): Failed opening '/home/directory/domains/website/public_html/wp-content/plugins/placements/placement_300x250.inc' for inclusion (include_path='/opt/bitnami/apache2/htdocs/weblog/community/library:.:.:/opt/bitnami/php/lib/php:/opt/bitnami/frameworks/smarty/libs') in /opt/bitnami/apache2/htdocs/weblog/community/library/adTags/Listener300x250Albums.php, line 8:
7: </p>
8: ';
9: }


What exactly is it telling me?

Thank you.
 
Those are really all the same errors as the first one you posted before. You'll need to contact the add-on author for guidance.
 
There is a reference to "adTags". I presume that should make it clear which add-on you've installed that's triggering it.
I'll look into that. Thank you. I'm working with a site that someone else set up, so I didn't install the add-on myself. That's why I'm not sure which one it is. For now, I just added the following line of code to library/config.php:

$config['enableListeners'] = false;

I will still go through and try to figure out which add-on is causing the problem, but at least I can now view the forum.

The forum home page is displaying correctly now. However, when I try to go to a specific forum, a thread, or just about any other link, I get the following message:

Not Found
The requested URL /community/index.php was not found on this server.

What might cause this? I moved all of the files over from the old server, and the old server didn't have this problem. I just checked, and there is an index.php file in /opt/bitnami/apache2/htdocs/weblog/community/

Thank you.


Edit: I didn't want to double-post, so I'm adding to my post. I checked, and there is a htaccess.txt file in /opt/bitnami/apache2/htdocs/weblog/community/

Below is the full text of the file:

# Mod_security can interfere with uploading of content such as attachments. If you
# cannot attach files, remove the "#" from the lines below.
#<IfModule mod_security.c>
# SecFilterEngine Off
# SecFilterScanPOST Off
#</IfModule>

ErrorDocument 401 default
ErrorDocument 403 default
ErrorDocument 404 default
ErrorDocument 500 default

<IfModule mod_rewrite.c>
RewriteEngine On

# If you are having problems with the rewrite rules, remove the "#" from the
# line that begins "RewriteBase" below. You will also have to change the path
# of the rewrite to reflect the path to your XenForo installation.
#RewriteBase /xenforo

# This line may be needed to enable WebDAV editing with PHP as a CGI.
#RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^(data/|js/|styles/|install/|favicon\.ico|crossdomain\.xml|robots\.txt) - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
</IfModule>
 
Last edited:
I checked, and there is a htaccess.txt file in /opt/bitnami/apache2/htdocs/weblog/community/
The file in question would actually be .htaccess (with the leading dot). You also need to make sure that AllowOverride is enabled for your VHosts/everywhere in your Apache config (it generally isn't by default).

An example URL would also help.
 
The file in question would actually be .htaccess (with the leading dot). You also need to make sure that AllowOverride is enabled for your VHosts/everywhere in your Apache config (it generally isn't by default).

An example URL would also help.

Thank you for your reply. I just sent you a conversation message with some additional info.

I checked, and apparently one of the .htaccess files didn't transfer over for some reason. I re-uploaded it, and now it is there. I couldn't tell before because my FTP program wasn't displaying them. Anyway, now there is a .htaccess file in both

/opt/bitnami/apache2/htdocs/weblog/

and

/opt/bitnami/apache2/htdocs/weblog/community/

The text of the one in "weblog" is:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress


The text of the one in "community" (the Xenforo directory) is:

# Mod_security can interfere with uploading of content such as attachments. If you
# cannot attach files, remove the "#" from the lines below.
#<IfModule mod_security.c>
# SecFilterEngine Off
# SecFilterScanPOST Off
#</IfModule>

ErrorDocument 401 default
ErrorDocument 403 default
ErrorDocument 404 default
ErrorDocument 500 default

<IfModule mod_rewrite.c>
RewriteEngine On

# If you are having problems with the rewrite rules, remove the "#" from the
# line that begins "RewriteBase" below. You will also have to change the path
# of the rewrite to reflect the path to your XenForo installation.
RewriteBase /community

# This line may be needed to enable WebDAV editing with PHP as a CGI.
#RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^(data/|js/|styles/|install/|favicon\.ico|crossdomain\.xml|robots\.txt) - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
</IfModule>


Thank you!
 
Last edited:
Based on the URL you sent me in the PM, this line is wrong:
Code:
RewriteBase /community
It needs "weblog" before it. Though you may not need the line at all (it's usually commented out).
 
I have one more question. On the moved copy of the site, the user profiles are not showing up correctly when you click them and they just pop up. If you click them and it actually goes to the profile page, it displays correctly. However, if you click it and it just pops up on the screen near the top, it doesn't show up correctly. It's kind of half there and half not there, and you can see through a white background. What might cause something like this to happen?

Thank you.
 
Looks like some sort of cache or server-level optimization system is caching the result incorrectly. The first load of a particular CSS URL is correct, but the second isn't. I believe this may be mod_pagespeed specifically, based on the Etag that is added when it isn't served correctly.
 
Looks like some sort of cache or server-level optimization system is caching the result incorrectly. The first load of a particular CSS URL is correct, but the second isn't. I believe this may be mod_pagespeed specifically, based on the Etag that is added when it isn't served correctly.
Okay, thank you. What would be the best way to go about fixing the problem?
 
Top Bottom