FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » FUDforum » How To » Moving whole website to a different server
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
Moving whole website to a different server [message #40290] Mon, 04 February 2008 20:56 Go to next message
WilliamBurns is currently offline  WilliamBurns   United States
Messages: 123
Registered: March 2004
Location: San Jose, CA
Karma: 0
Senior Member
I have been happy with version 2.6.4 for several years now (since 2004). At this point, however, the rest of my site is forcing me to change to a "larger" and newer server at the same hosting company. I will be retaining the FreeBSD unix. The support people have moved all the data and folders as follows:
the forumdata folder goes from /usr/local/forumdata to /usr/local/forumdata (In other words, no change.)
The "public" folder, does change path from
/usr/local/etc/httpd/htdocs/wforum to
/usr/local/apache2/htdocs/wforum.
Also, the mysql database changes from version 3.23 to version 5.0, and the data has been dumped, moved, and successfully imported from a database named mysql on the old server to a database named rpimysql on the new server.
I notice that all these paths and names are on the forum control panel. Is there any reason I can't change/update these values and just carry on? Is there some central file that I could modify the values in before launching the forum home page? Or do I have to go to square 1 and install the forum on the new server from scratch?
Thanks.
Re: Moving whole website to a different server [message #40294 is a reply to message #40290] Mon, 04 February 2008 21:14 Go to previous messageGo to next message
Ilia is currently offline  Ilia   United States
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
Change the paths inside GLOBALS.php in the include directory and then rebuild the theme via the admin panel.

FUDforum Core Developer
Re: Moving whole website to a different server [message #40303 is a reply to message #40290] Wed, 06 February 2008 01:28 Go to previous messageGo to next message
WilliamBurns is currently offline  WilliamBurns   United States
Messages: 123
Registered: March 2004
Location: San Jose, CA
Karma: 0
Senior Member
Thank you. You have been an amazing support for this system!

I do have another question about moving. I estimate it will take me about two weeks to get the "target" site up and tested. By that time, there will be dozens of new posts on the forum. I was thinking I could dump the database again and move the dump to the new site and import it. Would doing that be enough, or would I also have to move the /usr/local/forumdata folder again?
Re: Moving whole website to a different server [message #40308 is a reply to message #40303] Wed, 06 February 2008 18:27 Go to previous messageGo to next message
WilliamBurns is currently offline  WilliamBurns   United States
Messages: 123
Registered: March 2004
Location: San Jose, CA
Karma: 0
Senior Member
Oops! I made the GLOBALS.php changes and browsed to my wforum folder hoping to login and use the Admin Control Panel to rebuild the themes, but I get "internal server error" error 500 (Internet Explorer). With Firefox it does not generate that error, but displays a blank page. The site tech support people say it is something in the index.php code, which they do not support. Can you give me a clue? Is there a way to rebuild the themes from a command line? I know that most of the troubles I am having with other pages have to do with tighter security settings. But now all my regular html pages seem to work ok.
Re: Moving whole website to a different server [message #40310 is a reply to message #40303] Thu, 07 February 2008 01:46 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
Yes you would need to copy the data over as well since new message file was written to disk.

Error 500 implies a PHP error, check your PHP error log.


FUDforum Core Developer
Re: Moving whole website to a different server [message #40311 is a reply to message #40310] Thu, 07 February 2008 22:03 Go to previous messageGo to next message
WilliamBurns is currently offline  WilliamBurns   United States
Messages: 123
Registered: March 2004
Location: San Jose, CA
Karma: 0
Senior Member
The log indicated a referencing error at the first executible line of code in index.php, which has to do with requiring './GLOBALS.php'
The support person at the site host company copied this file into the same folder as the index.php is in, and the scene changed. Now my internet explorer displays a whole sequence of message lines, but below them the forum seems to have loaded and displayed ok.

Question 1. Why does the index.php file need the GLOBALS.php file to be moved to its same folder, and what has to change where so it works the way it did on the old site?

Question 2. The new error message is: NOTICE: Only variable references should be returned by reference in /usr/local/apache2/htdocs/wforum/index.php on line 280. This message is repeated for line 214, nine times for line 173, and again for line 214. Where would you suggest I go from this point?

Question 3. Since the screen below these messages seems normal, can I login and get to the admin control panel to rebuild the themes, or should I attempt to resolve these messages first?
Re: Moving whole website to a different server [message #40323 is a reply to message #40311] Sun, 10 February 2008 14:29 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
because index.php file reads GLOBALS.php from the current directly. On a FUDforum install you need to have only 1 GLOBALS.php file inside the include directory. The other two instances of the file are symlinks to it, one is inside web root and the other inside the adm/ directory.

FUDforum Core Developer
Re: Moving whole website to a different server [message #40326 is a reply to message #40323] Mon, 11 February 2008 18:11 Go to previous messageGo to next message
WilliamBurns is currently offline  WilliamBurns   United States
Messages: 123
Registered: March 2004
Location: San Jose, CA
Karma: 0
Senior Member
Thank you.
I am not sure I understand your response completely, but since you didn't say not to, I went ahead and logged in and the warning messages went away. The site seems to be working normally, and I haven't even rebuilt the themes yet. Truly amazing!
Re: Moving whole website to a different server [message #40328 is a reply to message #40323] Mon, 11 February 2008 18:20 Go to previous messageGo to next message
WilliamBurns is currently offline  WilliamBurns   United States
Messages: 123
Registered: March 2004
Location: San Jose, CA
Karma: 0
Senior Member
Oops. I saw what I wanted to see, not what really happened. When I went to login to the forum on the new site, the system kicked me back to the "old" site, where it does work correctly. Am I up against a "catch 22?" or can I really login on the new site. The first time I logged in, it gave me a profile form to fill in, which led me to believe it wanted to work. But the next step apparently loaded the page from the old site.
Re: Moving whole website to a different server [message #40329 is a reply to message #40328] Mon, 11 February 2008 18:25 Go to previous messageGo to next message
Ilia is currently offline  Ilia   United States
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
Login via the admin control panel http://yourforumurl/adm/

once you login rebuild the theme.


FUDforum Core Developer
Re: Moving whole website to a different server [message #40330 is a reply to message #40329] Tue, 12 February 2008 00:14 Go to previous messageGo to next message
WilliamBurns is currently offline  WilliamBurns   United States
Messages: 123
Registered: March 2004
Location: San Jose, CA
Karma: 0
Senior Member
When I go to http://198.106.29.5/wforum/adm/
I get the following two messages:
Warning: require(./GLOBALS.php) [function.require]: failed to open stream: No such file or directory in /usr/local/apache2/htdocs/wforum/adm/index.php on line 2

Fatal error: require() [function.require]: Failed opening required './GLOBALS.php' (include_path='.:') in /usr/local/apache2/htdocs/wforum/adm/index.php on line 2

I tried copying my updated GLOBALS.php into the adm directory, and after I do that I do get a login prompt, and then on to the admin control panel. But when I go to rebuild the themes, I get:

Notice: Only variable references should be returned by reference in /usr/local/forumdata/include/theme/default/db.inc on line 211

Notice: Only variable references should be returned by reference in /usr/local/forumdata/include/theme/default/db.inc on line 170

Warning: copy(/usr/local/forumdata/src/db.inc.t) [function.copy]: failed to open stream: Permission denied in /usr/local/forumdata/include/compiler.inc on line 506

Warning: fopen(/usr/local/forumdata/include/theme/default/security.inc) [function.fopen]: failed to open stream: Permission denied in /usr/local/forumdata/include/compiler.inc on line 367
Couldn't write to /usr/local/forumdata/include/theme/default/security.inc
I hope these messages mean something to you.

I have learned that my new account has php 5.2.5 which has only been out for about three months! I have an info function at http://198.106.29.5/testinfo.php, which I mention in case any php settings could be causing trouble.

Thanks once again for your assistance.
Re: Moving whole website to a different server [message #40332 is a reply to message #40330] Tue, 12 February 2008 17:49 Go to previous messageGo to next message
Ilia is currently offline  Ilia   United States
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
You need to make a symlink not a copy.
You also need to chmod the /usr/local/forumdata/src/ directory 777


FUDforum Core Developer
Re: Moving whole website to a different server [message #40333 is a reply to message #40332] Tue, 12 February 2008 17:57 Go to previous messageGo to next message
sallen812 is currently offline  sallen812   United States
Messages: 6
Registered: September 2006
Location: USA
Karma: 0
Junior Member
I have slmost the same problem (moved to new werver). I beleive the sim link is set up right but when I post I get this error.

Warning: fopen(/home/forum/FUDforum/messages/msg_280000) [function.fopen]: failed to open stream: Permission denied in /home/forum/public_html/theme/default/post.php on line 1858
FATAL ERROR: could not open message store for forum id#280000

Any ides what is making this happen?

New server is running both php4 and php 5 does not make a difference which the account runs under I get the same error.

On the old server things ran under "apache" user. With the new server every account runs under the account name.
Re: Moving whole website to a different server [message #40334 is a reply to message #40333] Tue, 12 February 2008 18:00 Go to previous messageGo to next message
sallen812 is currently offline  sallen812   United States
Messages: 6
Registered: September 2006
Location: USA
Karma: 0
Junior Member
also get these error when I tru to get top the admin

Warning: require(./GLOBALS.php) [function.require]: failed to open stream: No such file or directory in /home/forum/public_html/adm/admglobal.php on line 12

Warning: require(./GLOBALS.php) [function.require]: failed to open stream: No such file or directory in /home/forum/public_html/adm/admglobal.php on line 12

Fatal error: require() [function.require]: Failed opening required './GLOBALS.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/forum/public_html/adm/admglobal.php on line 12
Re: Moving whole website to a different server [message #40335 is a reply to message #40290] Tue, 12 February 2008 19:07 Go to previous messageGo to next message
WilliamBurns is currently offline  WilliamBurns   United States
Messages: 123
Registered: March 2004
Location: San Jose, CA
Karma: 0
Senior Member
Thanks.
I changed the GLOBALS.php references to be symlinks in the wforum directory and in the wforum/adm directory, and I changed the /usr/local/forumdata/scr directory to be 777.
However I got essentially the same messages, as follows:

Notice: Only variable references should be returned by reference in /usr/local/forumdata/include/theme/default/db.inc on line 211

Notice: Only variable references should be returned by reference in /usr/local/forumdata/include/theme/default/db.inc on line 207

Warning: copy(/usr/local/forumdata/src/db.inc.t) [function.copy]: failed to open stream: Permission denied in /usr/local/forumdata/include/compiler.inc on line 506

Warning: fopen(/usr/local/forumdata/include/theme/default/security.inc) [function.fopen]: failed to open stream: Permission denied in /usr/local/forumdata/include/compiler.inc on line 367
Couldn't write to /usr/local/forumdata/include/theme/default/security.inc

The theme rebuild appears to stop at this point. Do I need broader permissions on the folders mentioned above?

I'm wondering if the temporary domain name might be causing a problem (because of the security mention).

Since some of my permissions were not set correctly, is there some documentation showing what all the permissions should be?

[Updated on: Wed, 13 February 2008 20:18]

Report message to a moderator

Re: Moving whole website to a different server [message #40340 is a reply to message #40333] Wed, 13 February 2008 20:40 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
You need to chmod all files in the messages directory 666

FUDforum Core Developer
Re: Moving whole website to a different server [message #40343 is a reply to message #40340] Thu, 14 February 2008 00:16 Go to previous messageGo to next message
WilliamBurns is currently offline  WilliamBurns   United States
Messages: 123
Registered: March 2004
Location: San Jose, CA
Karma: 0
Senior Member
I changed the msg_1 file from 775 to 666, and the messages folder to 777, but I still get stopped in exactly the same place, with exactly the same messages, talking about line 506 and line 367 in compiler.inc.
I notice that on our older/current account, the forumdata folder is 711 and most of the folders within are 777. I tried changing the comparable folders to 777, but still no change in symptoms.
I had been using FTP to work with my older account. Since the new one requires SSH for certain functions, I went to the old account and learned that the true path to "see" the forumdata folder with SSH is /usr/home/rpi/usr/local/forumdata. On the new server, the path appears to be /usr/local/forumdata. I don't think this is relevant because the GLOBALS.php file did not use the longer path.
Should I be matching the permissions on the "old" (running) system? The control panel comes up nicely on the new system, but it does stop with the same four messages when I attempt to rebuild the theme.
Re: Moving whole website to a different server [message #40344 is a reply to message #40343] Thu, 14 February 2008 17:56 Go to previous messageGo to next message
Ilia is currently offline  Ilia   United States
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
Chmod all files inside /usr/local/forumdata/include/theme/default/ 666 as well and chmod the directory 777

FUDforum Core Developer
Re: Moving whole website to a different server [message #40345 is a reply to message #40344] Thu, 14 February 2008 19:16 Go to previous messageGo to next message
sallen812 is currently offline  sallen812   United States
Messages: 6
Registered: September 2006
Location: USA
Karma: 0
Junior Member
I found that the Global directory was not in the right place for my problem above. It was some how pointing to another account. Make Sure FUDform folder is in the right place (in the accoutn home folder) and that all symbolic links point to it. Once we got this straight and permisions set right, the forum worked properly.

Re: Moving whole website to a different server [message #40346 is a reply to message #40344] Thu, 14 February 2008 21:13 Go to previous messageGo to next message
WilliamBurns is currently offline  WilliamBurns   United States
Messages: 123
Registered: March 2004
Location: San Jose, CA
Karma: 0
Senior Member
Thanks so much. the theme rebuild appears to have completed normally.
Question: I notice that on the old/existing account installation the permissions are pretty restricted compared to the 666, for example. Should I go over the new system and attempt to set permissions the way the old one is set up?

Also, I am still getting a bunch of warnings and notices such as this one:
Notice: Only variable references should be returned by reference in /usr/local/forumdata/include/theme/default/db.inc on line 211
I assume there is a setting that suppresses them from displaying, but I have not found it if it exists.

NOW, I must have moved from the frying pan right into the fire. I just clicked on my first topic link on the forum home page, and I get this message:
Notice: Only variable references should be returned by reference in /usr/local/apache2/htdocs/wforum/index.php on line 214

Notice: Only variable references should be returned by reference in /usr/local/apache2/htdocs/wforum/index.php on line 214
UNABLE TO WRITE TO SQL LOG FILE
(/usr/local/apache2/htdocs/wforum/index.php:121
/usr/local/apache2/htdocs/wforum/theme/default/thread.php:475
/usr/local/apache2/htdocs/wforum/theme/default/thread.php:496
/usr/local/apache2/htdocs/wforum/index.php:1145
) 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'reads FROM fud261_fc_view v INNER JOIN fud261_forum f ON f.id=v.f INNER' at line 1
Query: SELECT f.id, f.name, c.name, c.id, CASE WHEN 1200338472 < m.post_stamp AND (fr.last_view IS NULL OR m.post_stamp > fr.last_view) THEN 1 ELSE 0 END AS reads FROM fud261_fc_view v INNER JOIN fud261_forum f ON f.id=v.f INNER JOIN fud261_cat c ON c.id=v.c LEFT JOIN fud261_msg m ON m.id=f.last_post_id LEFT JOIN fud261_forum_read fr ON fr.forum_id=f.id AND fr.user_id=2 ORDER BY v.id
Server Version: 5.0.45
Re: Moving whole website to a different server [message #40355 is a reply to message #40346] Sun, 17 February 2008 17:22 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
If you put the " CASE WHEN 1200338472 < m.post_stamp AND (fr.last_view IS NULL OR m.post_stamp > fr.last_view) THEN 1 ELSE 0 END" expression inside brackets does the query run properly?

FUDforum Core Developer
Re: Moving whole website to a different server [message #40365 is a reply to message #40355] Tue, 19 February 2008 21:11 Go to previous messageGo to next message
WilliamBurns is currently offline  WilliamBurns   United States
Messages: 123
Registered: March 2004
Location: San Jose, CA
Karma: 0
Senior Member
Where would I find the code to make this change?
Re: Moving whole website to a different server [message #40368 is a reply to message #40365] Wed, 20 February 2008 03:05 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
Just try running the failed query with the suggested change manually.

FUDforum Core Developer
Re: Moving whole website to a different server [message #40372 is a reply to message #40368] Wed, 20 February 2008 22:29 Go to previous messageGo to next message
WilliamBurns is currently offline  WilliamBurns   United States
Messages: 123
Registered: March 2004
Location: San Jose, CA
Karma: 0
Senior Member
I modified the query to have square brackets where requested. Running the query manually from the command line generates the same message, saying that there is an error in the SQL syntax.

mysql version 5.0.45
Re: Moving whole website to a different server [message #40374 is a reply to message #40372] Thu, 21 February 2008 03:00 Go to previous messageGo to next message
WilliamBurns is currently offline  WilliamBurns   United States
Messages: 123
Registered: March 2004
Location: San Jose, CA
Karma: 0
Senior Member
Oops.
I had a tech support fellow change the php.ini file so as to suppress all the notices and warnings that were occurring, and then I went to show him the SQL error, and the darn thing worked instead of giving me the error. I was able to look up an actual message. I had been playing around with the ssh mysql interface just a little bit, but only to display databases and tables. I will push the forum software a bit harder, but assuming it works, I assume I will backup the board data on the old site, download it, upload it to the new site, and "restore" it somehow so that it wipes out the data that is currently in place which is a few weeks old now.
Re: Moving whole website to a different server [message #40378 is a reply to message #40372] Thu, 21 February 2008 13:41 Go to previous messageGo to next message
Ilia is currently offline  Ilia   United States
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
Can you try changing the word "reads" into "_reads" perhaps reads became a reserved word in MySQL.

FUDforum Core Developer
Re: Moving whole website to a different server [message #40380 is a reply to message #40378] Thu, 21 February 2008 18:31 Go to previous messageGo to next message
WilliamBurns is currently offline  WilliamBurns   United States
Messages: 123
Registered: March 2004
Location: San Jose, CA
Karma: 0
Senior Member
I do not understand what is happening. When I attempt to access posts on the forum, it seems to be working perfectly (and for no apparent reason). When I attempt to run the query manually, I get the following, both with "reads" and with "_reads" — It looks like it doesn't like the way the command is broken up on several lines.

mysql> SELECT f.id, f.name, c.name, c.id, CASE WHEN 1200338472 < m.post_stamp AND (fr.last_view I -> S NULL OR m.post_stamp > fr.last_view) THEN 1 ELSE 0 END AS reads FROM fud261_fc_view v INNER JOI
-> N fud261_forum f ON f.id=v.f INNER JOIN fud261_cat c ON c.id=v.c LEFT JOIN fud261_msg m ON m.id=f
-> .last_post_id LEFT JOIN fud261_forum_read fr ON fr.forum_id=f.id AND fr.user_id=2 ORDER BY v.id
-> ;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'I
S NULL OR m.post_stamp > fr.last_view) THEN 1 ELSE 0 END AS
reads FROM fud261_' at line 1
---------------------------------
and when I type it in at the command line instead of pasting, I get:
mysql> SELECT f.id, f.name, c.name, c.id, CASE WHEN 1200338472 < m.post_stamp AND (fr.last_view IS NULL OR m.post_stamp > fr.last_view) THEN 1 ELSE 0 END AS reads FROM fud261_fc_view v INNER JOIN fud261_forum f ON f.id=v.f INNER JOIN fud261_cat c ON c.id=v.c LEFT JOIN fud261_msg m ON m.id=f.last_post_id LEFT JOIN fud261_forum_read fr ON fr.forum_id=f.id AND fr.user_id=2 ORDER BY v.id;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'reads FROM fud261_fc_view v INNER JOIN fud261_forum f ON f.id=v.f INNER JOIN fud' at line 1
mysql>

Why is the forum working?
Re: Moving whole website to a different server [message #40381 is a reply to message #40380] Thu, 21 February 2008 19:26 Go to previous messageGo to next message
WilliamBurns is currently offline  WilliamBurns   United States
Messages: 123
Registered: March 2004
Location: San Jose, CA
Karma: 0
Senior Member
The mysql manual for 5.0.45 does not seem to show a list of language differences from prior releases. It does show a CASE function as well as a CASE statement. I don't know the difference, except that the CASE statement requires an END CASE while the function can do with just an END. Can it be wanting to interpret the CASE function as a statement?
Re: Moving whole website to a different server [message #40382 is a reply to message #40381] Fri, 22 February 2008 21:17 Go to previous messageGo to next message
WilliamBurns is currently offline  WilliamBurns   United States
Messages: 123
Registered: March 2004
Location: San Jose, CA
Karma: 0
Senior Member
OK, the messages seem to work ok, but when I go to login as administrator I get:
UNABLE TO WRITE TO SQL LOG FILE
(/usr/local/apache2/htdocs/wforum/index.php:121
/usr/local/apache2/htdocs/wforum/theme/default/msg.php:1091
/usr/local/apache2/htdocs/wforum/theme/default/msg.php:1112
/usr/local/apache2/htdocs/wforum/index.php:1145
) 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'reads FROM fud261_fc_view v INNER JOIN fud261_forum f ON f.id=v.f INNER' at line 1
Query: SELECT f.id, f.name, c.name, c.id, CASE WHEN 1200338472 < m.post_stamp AND (fr.last_view IS NULL OR m.post_stamp > fr.last_view) THEN 1 ELSE 0 END AS reads FROM fud261_fc_view v INNER JOIN fud261_forum f ON f.id=v.f INNER JOIN fud261_cat c ON c.id=v.c LEFT JOIN fud261_msg m ON m.id=f.last_post_id LEFT JOIN fud261_forum_read fr ON fr.forum_id=f.id AND fr.user_id=2 ORDER BY v.id
Server Version: 5.0.45

The system appears to let me login, and it appears to run ok afterwards, but I'm still getting this message which looks identical to the earlier ones.

In chasing this with site support people, we did not find it happening after the one occurrance. I was able to login without messages, and everything seems to work perfectly. This seems to be a situational or occasional thing, somehow. In just trying to access a post, it happened again. It seems to happen randomly. When it does happen, the user is surely baffled as to what to do. Any thoughts?

[Updated on: Fri, 22 February 2008 22:33]

Report message to a moderator

Re: Moving whole website to a different server [message #40389 is a reply to message #40382] Sun, 24 February 2008 15:57 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
Have you tried putting the entire CASE statement inside brackets?

FUDforum Core Developer
Re: Moving whole website to a different server [message #40390 is a reply to message #40389] Sun, 24 February 2008 21:50 Go to previous messageGo to next message
WilliamBurns is currently offline  WilliamBurns   United States
Messages: 123
Registered: March 2004
Location: San Jose, CA
Karma: 0
Senior Member
Yes I have tried the query with square brackets [ ] around the CASE statement. It returns the same error message with or without the brackets, In other words, it never has worked when done as a stand-alone query. But then why does the forum function correctly sometimes? Is there a place in one of the modules where I might attempt to modify some code to add the square brackets?

Here is the excerpted query with the square brackets in place:
mysql> SELECT f.id, f.name, c.name, c.id, [CASE WHEN 1200338472 < m.post_stamp AND (fr.last_view IS NULL OR m.post_stamp > fr.last_view) THEN 1 ELSE 0 END]
-> AS reads FROM fud261_fc_view v INNER JOIN fud261_forum f ON f.id=v.f INNER JOIN fud261_cat c ON c.id=v.c LEFT JOIN fud261_msg m ON m.id=f.last_post_id
-> LEFT JOIN fud261_forum_read fr ON fr.forum_id=f.id AND fr.user_id=2 ORDER BY v.id;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '[CASE WHEN 1200338472 < m.post_stamp AND (fr.last_view IS NULL OR m.post_stamp >' at line 1

For what it is worth, I seem to be unable to hang the forum as an unlogged in viewer. Once I login, I am unable to access any posts, or topics.

I attempted to look up the syntax in the mysql manual for version 5.0, and I see no syntax issue in the function itself. The manual (for the second version) reads:

CASE WHEN [condition] THEN result [WHEN [condition] THEN result ...] [ELSE result] END

The first version returns the result where value=compare_value. The second version returns the result for the first condition that is true. If there was no matching result value, the result after ELSE is returned, or NULL if there is no ELSE part.

mysql> SELECT CASE 1 WHEN 1 THEN 'one'
-> WHEN 2 THEN 'two' ELSE 'more' END;
-> 'one'
mysql> SELECT CASE WHEN 1>0 THEN 'true' ELSE 'false' END;
-> 'true'
mysql> SELECT CASE BINARY 'B'
-> WHEN 'a' THEN 1 WHEN 'b' THEN 2 END;
-> NULL
The default return type of a CASE expression is the compatible aggregated type of all return values, but also depends on the context in which it is used. If used in a string context, the result is returned as a string. If used in a numeric context, then the result is returned as a decimal, real, or integer value.

Note
The syntax of the CASE expression shown here differs slightly from that of the SQL CASE statement described in Section 17.2.10.2, “CASE Statement”, for use inside stored routines. The CASE statement cannot have an ELSE NULL clause, and it is terminated with END CASE instead of END.

[Updated on: Mon, 25 February 2008 20:40]

Report message to a moderator

Re: Moving whole website to a different server [message #40396 is a reply to message #40390] Mon, 25 February 2008 23:41 Go to previous messageGo to next message
WilliamBurns is currently offline  WilliamBurns   United States
Messages: 123
Registered: March 2004
Location: San Jose, CA
Karma: 0
Senior Member
The syntax error may have more to do with the AS that follows the CASE expression thsn it does with the CASE expression.

I have been looking for syntax changes, and I found the following note about JOINS via google. Can it be part of the trouble? Here is the note:

Beginning with MySQL 5.0.12, natural joins and joins with USING, including outer join variants, are processed according to the SQL:2003 standard. The goal was to align the syntax and semantics of MySQL with respect to NATURAL JOIN and JOIN ... USING according to SQL:2003. However, these changes in join processing can result in different output columns for some joins. Also, some queries that appeared to work correctly in older versions must be rewritten to comply with the standard.
Re: Moving whole website to a different server [message #40398 is a reply to message #40396] Tue, 26 February 2008 00:06 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
The join syntax is common you need to use () brackets

FUDforum Core Developer
Re: Moving whole website to a different server [message #40399 is a reply to message #40398] Tue, 26 February 2008 01:06 Go to previous messageGo to next message
WilliamBurns is currently offline  WilliamBurns   United States
Messages: 123
Registered: March 2004
Location: San Jose, CA
Karma: 0
Senior Member
I know I am too wordy, but your message might be too brief!
I don't understand the reference to JOIN syntax being common.

I repeated the manual SELECT command using parentheses around the CASE function. I got this response:

mysql> SELECT f.id, f.name, c.name, c.id, (CASE WHEN 1200338472 < m.post_stamp
-> AND (fr.last_view IS NULL OR m.post_stamp > fr.last_view) THEN 1 ELSE 0 END)
-> AS reads FROM fud261_fc_view v INNER JOIN fud261_forum f ON f.id=v.f
-> INNER JOIN fud261_cat c ON c.id=v.c LEFT JOIN fud261_msg m ON m.id=f.last_post_id
-> LEFT JOIN fud261_forum_read fr ON fr.forum_id=f.id AND fr.user_id=2 ORDER BY v.id;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds
to your MySQL server version for the right syntax to use near 'reads FROM fud261_fc_view v
INNER JOIN fud261_forum f ON f.id=v.f INNER JOIN fud' at line 3
Re: Moving whole website to a different server [message #40408 is a reply to message #40399] Tue, 26 February 2008 23:58 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
Ok, the problem the "reads" it seems newer version of MySQL consider this to be a keyword causing the query to fail.

I tried looking for the query inside existing version of the forum but cannot find it.


FUDforum Core Developer
Re: Moving whole website to a different server [message #40409 is a reply to message #40408] Wed, 27 February 2008 01:21 Go to previous messageGo to next message
WilliamBurns is currently offline  WilliamBurns   United States
Messages: 123
Registered: March 2004
Location: San Jose, CA
Karma: 0
Senior Member
OK, although I don't know what the word "reads" is doing in the query (is it a variable or a keyword of some sort?), I was able to verify in the manual that both "READ" and "READS" are reserved words in mysql 5.0. Now that I have learned how to do a manual SELECT, I was able to change "reads" to "_reads" and the query appears to work, at least in terms of syntax:

mysql> SELECT f.id, f.name, c.name, c.id, (CASE WHEN 1200338472 < m.post_stamp
-> AND (fr.last_view IS NULL OR m.post_stamp > fr.last_view) THEN 1 ELSE 0 END)
-> AS _reads FROM fud261_fc_view v INNER JOIN fud261_forum f ON f.id=v.f
-> INNER JOIN fud261_cat c ON c.id=v.c LEFT JOIN fud261_msg m ON m.id=f.last_post_i
d
-> LEFT JOIN fud261_forum_read fr ON fr.forum_id=f.id AND fr.user_id=2 ORDER BY v.id;
+----+--------------------------------------+------------------------------ -----+----+-----
---+
| id | name | name | id | _rea
ds |
+----+--------------------------------------+------------------------------ -----+----+-----
---+
| 12 | Current Books, Articles, Films, etc. | Religion and Ministry Discussions | 3 |
1 |
| 22 | Whole-Community Catechesis | Religion and Ministry Discussions | 3 |
0 |
| 19 | Current ML Issue | Religion and Ministry Discussions | 3 |
0 |
| 15 | Environment & Art | Religion and Ministry Discussions | 3 |
0 |
| 17 | Liturgical Music | Religion and Ministry Discussions | 3 |
1 |
| 16 | Liturgy and Liturgical Ministry | Religion and Ministry Discussions | 3 |
1 |
| 8 | Pastoral Ministry/Social Justice | Religion and Ministry Discussions | 3 |
0 |
| 14 | RCIA and Catechesis | Religion and Ministry Discussions | 3 |
0 |
+----+--------------------------------------+------------------------------ -----+----+-----
---+
8 rows in set (0.22 sec)
-----------------------------------------------------------

Just generally, what should I do? Can I search through the php looking for "reads" and changing it to "_reads"? What about "read"? Can you tell me what the word "reads" means in the query we have been working with?
Re: Moving whole website to a different server [message #40420 is a reply to message #40409] Wed, 27 February 2008 23:34 Go to previous messageGo to next message
WilliamBurns is currently offline  WilliamBurns   United States
Messages: 123
Registered: March 2004
Location: San Jose, CA
Karma: 0
Senior Member
I tried looking through the code files (having no idea where to really start looking, and I do not find the exact query anywhere — by eye. I did not look for it with a search function.

I did find a couple dozen CASE functions, but all but two or three of them already have enclosing parentheses around them. (attach.inc.t, forumsel.inc.t, and index.php.t need parens)

I did not see any reference to "reads." Can you give me a hierarchy of forum files, or maybe just tell me where to look first, second, etc.? Would I start with the include folder? Or with a template folder? If I do make a code change, what do I do to make it "live" — or does that depend on where the change occurs?
Re: Moving whole website to a different server [message #40422 is a reply to message #40420] Thu, 28 February 2008 00:23 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
The reads reference would be inside src/ directory, you can find the offending file by doing grep reads *.t
Then replace reads with _reads.


FUDforum Core Developer
Re: Moving whole website to a different server [message #40426 is a reply to message #40420] Thu, 28 February 2008 00:40 Go to previous messageGo to next message
WilliamBurns is currently offline  WilliamBurns   United States
Messages: 123
Registered: March 2004
Location: San Jose, CA
Karma: 0
Senior Member
I believe I have found the query: It is in my forumdata/include/theme/default/forumsel.inc. Here is the operative section, with th e CASE info on line 1:

$c = uq('SELECT f.id, f.name, c.name, c.id, CASE WHEN '.$GLOBALS['usr']->last_read.' < m.post_stamp AND (fr.last_view IS NULL OR m.post_stamp > fr.last_view) THEN 1 ELSE 0 END AS reads
FROM fud261_fc_view v
INNER JOIN fud261_forum f ON f.id=v.f
INNER JOIN fud261_cat c ON c.id=v.c
LEFT JOIN fud261_msg m ON m.id=f.last_post_id
'.($mod ? '' : 'LEFT JOIN fud261_mod mm ON mm.user_id='._uid.' AND mm.forum_id=f.id INNER JOIN fud261_group_cache g1 ON g1.resource_id=f.id AND g1.user_id=2147483647 LEFT JOIN fud261_group_cache g2 ON g2.resource_id=f.id AND g2.user_id='._uid).'
LEFT JOIN fud261_forum_read fr ON fr.forum_id=f.id AND fr.user_id='._uid.'
'.($mod ? '' : ' WHERE mm.id IS NOT NULL OR ((CASE WHEN g2.id IS NULL THEN g1.group_cache_opt ELSE g2.group_cache_opt END) & 1) > 0').'
ORDER BY v.id');

Should I change it? If I do, what do I do then. I still have no idea about "reads".

[Updated on: Thu, 28 February 2008 04:07]

Report message to a moderator

Re: Moving whole website to a different server [message #40434 is a reply to message #40426] Fri, 29 February 2008 01:21 Go to previous messageGo to previous message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
Just change "reads" into "_reads"

FUDforum Core Developer
Pages (2): [1  2    »]  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: disable poll
Next Topic: query string for subject/body
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Thu Nov 21 20:23:15 GMT 2024

Total time taken to generate the page: 0.04100 seconds