Error when moving site
Archived from the LCMS Discussion forum.
njw — Tue Nov 14, 2006 11:19 am
I’ve just moved the site to a different hosting area, and I am getting this error:
Fatal error: Call to a member function on a non-object in /home/archomai/public_html/templates_c/default/%%D7^D73^D73BB5E8%%MainTemplate.html.php on line 54
I can’t get into the file to see what is causing the error. Any thoughts?
Many thanks
Neil
shannah — Tue Nov 14, 2006 12:17 pm
OK.. this is solvable, and is probably just a really simple little thing, but your inability to access the file will make this a bit tricky.
You probably cannot see the file because it was created by the web server and won’t allow your user to read it. Hence to access this file, you must use the web server process.
Make a simple PHP script on your web server with the following:
- Code: Select all
php print_r(file('/home/archomai/public_html/templates_c/default/%%D7^D73^D73BB5E8%%MainTemplate.html.php')); ?
Then run this script from your web browser. This will display the contents of that file in an array. The suspect line should be located at index 53 of the printed array.
That will give us a clue as to what object it can’t find.
Most likely this is an issue with the .htaccess file - or perhaps even a petty connection issue with the database.
Best regards
Steve
njw — Tue Nov 14, 2006 1:43 pm
Thanks Steve. I think it’s a connection issue, because it’s now gone away since I got the nameservers corrected. However, I’ve now lost all the formatting and images … I’m checking through all the file references and pointers now to see what needs to be corrected.
Neil
njw — Tue Nov 14, 2006 1:59 pm
I was wrong - the change is that it is writing the error to the log file now …
njw — Tue Nov 14, 2006 2:02 pm
Lines 53 & 54 are as follows:
[53] =>
_tpl_vars[‘page’]->val(‘header_image’)): ?>style=”background:#505050 url(_tpl_vars[‘ENV’][‘DATAFACE_SITE_URL’]; ?>
[54] => /tables/pages/header_image/_tpl_vars[‘page’]->val(‘header_image’); ?>
shannah — Tue Nov 14, 2006 2:13 pm
OK.. so it appears it is not managing to load the requested page from the database. Is this appearing on a page where the content is drawn from the database, or from the file system? If you can give me the url, I can take a closer look to see if anything jumps out.
As it is, I’d say the problem probably lies in the .htaccess file or the apache config file (perhaps not allowing certain options to be used in the .htaccess file).
-Steve
njw — Tue Nov 14, 2006 2:16 pm
The url is www.archomai.co.uk. The admin module is working fine. This is occurring on all pages.
It is a new site, but the same hosting company. Possibly a different server.
The .htaccess file is:
RewriteEngine On
RewriteRule ^$ index.php
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_fileNAME} !-f
RewriteRule ^(.*)$ public.php?-path=$1
RewriteCond %{HTTPS} !=on
RewriteCond %{REQUEST_URI} ^.*admin.php
RewriteRule ^/(.*) https://%{SERVER_NAME}/$1 [L,R]
Deny from all
#
#RewriteEngine on
#RewriteCond %{SERVER_PORT} =80
#RewriteRule ^(.*) https://%{SERVER_NAME}%{REQUEST_URI}
#
SecFilterEngine Off
SecFilterScanPOST Off
njw — Tue Nov 14, 2006 2:38 pm
If it’s any help, it doesn’t seem to recognise the [ENV] and/or [APPLICATION] variables. Nothing that refers to them is being displayed.
njw — Tue Nov 14, 2006 4:18 pm
It is definitely something to do with $ENV not being set. I have deleted the $ENV.DATAFACE_SITE_URL from MainTemplate.html and the formatting has come back. The edits should solve my problem short-term: getting the web site looking reasonable, but I would still like to put it back the way it was!
Neil
njw — Wed Nov 15, 2006 3:00 am
Hi Steve
Overnight, I have changed nothing, but now there are errors occurring on different lines and the site will not display. Any thoughts?
Neil
njw — Wed Nov 15, 2006 3:01 am
Ignore the above - looking at the wrong site!
Regards
Neil
shannah — Wed Nov 15, 2006 4:11 pm
Is it at all possible that the new site is using a different installation of Dataface (an older install) than it was on the older server?
The $ENV variable is crucial to the templates.
One possibility is also that the compiled template is for an older install. Making any changes to the MainTemplate.html template should update the timestamp and cause the template to be recompiled though - this could be the actual reason why removing $ENV.DATAFACE_SITE_URL made it work before.
-Steve
njw — Wed Nov 15, 2006 11:16 pm
The version of dataface is the same. I copied the whole site over (it was a sub directory of the QSG site.
My hosting company have said “the only difference is that Register_globals is OFF on the new server (much safer with regard security)”. Could this be the problem?
Neil
njw — Thu Nov 16, 2006 12:26 am
Having done some searching, and acknowledging my limited understanding of PHP, I have tried changing my htaccess directive to set Register_globals to on, but this causes the site to error. Do I need to change the startup code code somehow?
Many thanks
Neil
njw — Thu Nov 16, 2006 6:15 am
Almost there - I’ve amended all the $ENV references to $_ENV. Now the menu tabs have gone missing, but that’s probably just a tag in the worng place, I hope!
njw — Wed Nov 15, 2006 3:01 am
Ignore the above - looking at the wrong site!
Regards
Neil
shannah — Wed Nov 15, 2006 4:11 pm
Is it at all possible that the new site is using a different installation of Dataface (an older install) than it was on the older server?
The $ENV variable is crucial to the templates.
One possibility is also that the compiled template is for an older install. Making any changes to the MainTemplate.html template should update the timestamp and cause the template to be recompiled though - this could be the actual reason why removing $ENV.DATAFACE_SITE_URL made it work before.
-Steve
njw — Wed Nov 15, 2006 11:16 pm
The version of dataface is the same. I copied the whole site over (it was a sub directory of the QSG site.
My hosting company have said “the only difference is that Register_globals is OFF on the new server (much safer with regard security)”. Could this be the problem?
Neil
njw — Thu Nov 16, 2006 12:26 am
Having done some searching, and acknowledging my limited understanding of PHP, I have tried changing my htaccess directive to set Register_globals to on, but this causes the site to error. Do I need to change the startup code code somehow?
Many thanks
Neil
njw — Thu Nov 16, 2006 6:15 am
Almost there - I’ve amended all the $ENV references to $_ENV. Now the menu tabs have gone missing, but that’s probably just a tag in the worng place, I hope!
njw — Thu Nov 16, 2006 6:38 am
Looking through the code, that would appear to be a problem loading the page references into the PAGES array - is this also a global variable? And if so, how do I change the code to make it global?
Neil
shannah — Thu Nov 16, 2006 5:06 pm
Wow.. you’re going at it hard here….
First: I keep register globals off on all of my servers for security reasons. Dataface will work fine with this setting.
I’d be a little wary before changing too many of the variables in the template. The $ENV shoud be $ENV and not $_ENV, for example.
It is painful thinking of the pain you must be going through trying to get this working, but my best advice, before taking the hatchet to your site any further, might be to try installing the default version of LCMS on the new server and see if it has the same problems. If it does, then we can try hatcheting that (rather than taking your whole site apart). Certainly the problem is just one simple setting on the server’s end, or in the configuration.
One thing to try also, is try entering the explicit address to the page. e.g. http://www.archomai.co.uk/index.php instead of http://www.archomai.co.uk …. it could be a problem with not picking up the page name properly and getting null page….
-Steve
njw — Thu Nov 16, 2006 5:46 pm
On the $ENV, it works when I change them to $_ENV … There weren’t that many of them - only in the one script.
I have tried entering explicit addresses e.g. www.archomai.co.uk/about.php and that errors. www.archomai.co.uk/index.php gives the same result as www.archomai.co.uk
All my Dataface applications are working fine; this only affects LCMS. Even admin.php works for the LCMS site!
The menu tabs are not displaying - and the code would suggest that that means the pages array is not being filled.
I’ll have a look at reloading LCMS onto the new site, but it is now live because I had to change the nameservers to test because of the addressing problems with the scripts - or so I thought at the time!
Happy days.
Neil
njw — Fri Nov 17, 2006 10:38 am
Ok Steve, I reset styles.css and MainTemplate.html from the original source. The site displayed all the text but wothout any formatting, so I made the following changes to MainTemplate.html:
* Changed all references to $ENV to $_ENV. This got the styles .css working, but lost the horizontal menu and the logo.
* Added reference to archomai_style.css This got the widths almost correct, but that’s probably due to me not editing the correct file originally.
* Changed $_ENV back to $ENV for horizontal menu section. Started working.
* Changed $_ENV back to $ENV for logo section. Started working.
* “Sites” section not working - commented out. This displays fine, but errors with call to invalid module, or something similar, when clicked.
So, on the plus side, I have a working site - many thanks for reminding me of first principles!
On the downside, I still don’t understand what has caused the problem!
Any further thoughts?
Neil