Topic: Help... "Parse error: syntax error, unexpected... '

I moved the the forum location and changed the base URL on the database, but I didn't change the base URL through admin/options first. Now I get: "Parse error: syntax error, unexpected '.' in /data/17/1/144/15/1688015/user/1766625/htdocs/(new forum URL)/include/functions.php on line 789". Line 789 and others are still showing the old URL. But even if I change the base URL and put the files back to the previous location, I can't open the forum at all and continue to get the same error, only with the old URL. I think the big issue is that I didn't change the base URL through admin/options first. How do I fix that? Please help, I'm stuck on this one. Thanks.

Re: Help... "Parse error: syntax error, unexpected... '

What is version of your forum? First of all you need to ensure that new location is valid HTTP-URL. After that remove .php files from forum-cache directory.

Re: Help... "Parse error: syntax error, unexpected... '

It's version 1.2, location and url are correct, and I have cleared the cache folder. This almost happened once before but I was able to avoid the problem. NOt this time. Changing the base URL in the database is not enough, you must first change the base url in administration/options to apply the information to all files. I didn't do that, and now I can't access administration/options. What do I do? Thanks.

Re: Help... "Parse error: syntax error, unexpected... '

Version 1.2.20 to be exact. I can send you all the files and/or the database if it will help. Thanks.

5

Re: Help... "Parse error: syntax error, unexpected... '

AlexanderS wrote:

Changing the base URL in the database is not enough, you must first change the base url in administration/options to apply the information to all files.

The only difference that altering through the admin panel makes is that the cache files are regenerated upon the values being submitted. Delete the cache files once you have corrected the base URI in the database, and exactly the same outcome is achieved.

Re: Help... "Parse error: syntax error, unexpected... '

Hi Matt,

Thanks for helping.

In the past I have changed the base url in the database, deleted all the .php files in the cache folder, and lost access to the forum. I had to put the forum back to the old location and url to access administration/options, where I would change the base url first, relocate the forum, and then change the base url in the database to make it work. Maybe it doesn't make sense, but I'm almost positive that's what happened.

Anyway, before I noticed this problem I was making a few changes to the site, including installing xampp test server and a database independent from PunBB. I'm using Dreamweaver CS3, and have noticed that relative urls don't work correctly on the main.tpl template file where I've added a header and footer to make the forum match the site. I'll make a link normally and it shows ../../file.html, but it won't work. I'll have to manually make it ../../../file.html (or something like that) to make it work. I don't know if that's relevant or not.

Any ideas?

Thanks again.

Re: Help... "Parse error: syntax error, unexpected... '

I just exported the database to my computer and made the connection on my test server. Tested and confirmed the connection. But I still have the same problem as with the database and files on the host. If change the base url in the database and clear the cache folder it does not change the base url in any of the files. It remains the same (the old base url).

8

Re: Help... "Parse error: syntax error, unexpected... '

AlexanderS wrote:

If change the base url in the database and clear the cache folder it does not change the base url in any of the files. It remains the same (the old base url).

In any of which files? The base URI is dynamic, as such. The only place where it is cached is in the config cache file. Every other file obtains the base URI from there. If it has not changed, the config cache has not been deleted or regenerated.

Re: Help... "Parse error: syntax error, unexpected... '

Hi Matt,

Are there cache files I'm missing somewhere? I go to ../myforum/cache/ and delete all php files, leaving index.html and .htaccess.

Here is a piece of /myforum/include/common_admin.php. Showing all old URLs after updating the database:

"<li<?php if ($page == 'index') echo ' class="isactive"'; ?>><a href="../../../oldurl/myforum/include/admin_index.php">Index</a></li>
<?php if ($is_admin): ?>                    <li<?php if ($page == 'categories') echo ' class="isactive"'; ?>><a href="../../../oldurl/myforum/include/admin_categories.php">Categories</a></li>
<?php endif; ?><?php if ($is_admin): ?>                    <li<?php if ($page == 'forums') echo ' class="isactive"'; ?>><a href="../../../oldurl/myforum/include/admin_forums.php">Forums</a></li>
<?php endif; ?>                    <li<?php if ($page == 'users') echo ' class="isactive"'; ?>><a href="../../../oldurl/myforum/include/admin_users.php">Users</a></li>"

Does that help? Thanks again.

10

Re: Help... "Parse error: syntax error, unexpected... '

Those files have been altered then. That relative path is completely wrong. I'd need to double check a virgin admin file to say 100% certainly, but this part:

../../../oldurl/myforum

should not be there. It should be using the pun_root constant which is defined at the top of the file, rather than being hardcoded like that snippet you posted above.

Re: Help... "Parse error: syntax error, unexpected... '

So those hard urls should be dynamic includes? I have no idea how that could have happened. I have a backup from a while ago and it's the same thing. Any ideas what caused it? Is there a fix. If I reinstall I can't lose all the work I did on the template and styles. The database is no big deal.

12

Re: Help... "Parse error: syntax error, unexpected... '

Just double checked on a fresh 1.2* download, and that first line in your code above should be:

<li<?php if ($page == 'index') echo ' class="isactive"'; ?>><a href="admin_index.php">Index</a></li>

Check against a virgin download and see which files you need to alter and how. If all of your files have hardcoded paths, and you have quite a few mods installed, you're going to have to use the likes of sed on *nix or some search and replace utility for M$ if you wish to avoid altering them all by hand.

Re: Help... "Parse error: syntax error, unexpected... '

What if I just did a new install and swapped the template, styles and database?

14

Re: Help... "Parse error: syntax error, unexpected... '

If you have a standard setup, i.e: not modded, then that approach would be fine. Just upload the new files, (after backing up your existing forum dir), and copy the config file and your modified templates and styles across. No need to reinstall the db.

Re: Help... "Parse error: syntax error, unexpected... '

I guess it's standard. All I've added other than the the main.tpl and styles was a captcha script on the registration page. But I really wish I had an idea what caused this, so it doesn't happen again. Like I said, the big change I made before noticing the problem was adding xampp php MySql test server, moving the site to the test server /htdocs/ folder and adding another database.

Re: Help... "Parse error: syntax error, unexpected... '

Matt,

I got a fresh download and replaced the 7 /include/ files because it seemed like they had all the hard code (old) urls. This gave me an error in the header.php file. I replaced that with a fresh file and it's fixed. Everything works! I'm never going to change the base url in the database before administration/options. It still seems like that had something to do with it.

Thanks for all your help, and Happy Holidays!

17

Re: Help... "Parse error: syntax error, unexpected... '

AlexanderS wrote:

I'm never going to change the base url in the database before administration/options. It still seems like that had something to do with it.

That didn't cause it in any way or form. It is quite safe to do it that way. Those files were altered by someone or something else.

Glad to hear you're back up and running. smile