Broken link Issues moving site to local environment

Permalink
Hello,

I've recently been handed a c5 site (running 5.6.3.4). I received a .zip of the files and the .sql database. I was able to get a local install working with MAMP and can now see the home page and am able to login to the admin area. The issues are:
- Many images are missing due to broken links
- I receive an "Error establishing database connection" when I try to navigate to any page other than the home page.
- In the admin area, the dashboard is blank. Dev tools says I'm missing jquery which makes me thinks this has something to do with set_theme_paths.php file but this site's theme is buried in the site /packages/theme_structura/themes/structura so just entering the "structura" in setThemeByPath doesn't work.

Any suggestions?

undertow
 
hutman replied on at Permalink Reply
hutman
In the files you got was there by chance cache files in /files/cache? Those can cause really weird issues
undertow replied on at Permalink Reply
undertow
Thanks for the suggestion. I just checked and there were files in the cache folder. I removed them but it hasn't fixed any of these issues.
undertow replied on at Permalink Reply
undertow
Update:
Broken images are now working. I had to manually edit the html blocks to adjust the image url.

Unfortunately, all pages other than the home page cause the white screen of death "Error Establishing Database Connection" and the admin issues are still present (jquery not loading). If anyone has suggestions for those issues then I'm all ears. Thanks
hutman replied on at Permalink Reply
hutman
Did you try removing the .htaccess file and checking the /config/site.php to make sure there is no BASE_URL defined? Pretty URLs and site.php can both cause issues when moving a site
undertow replied on at Permalink Reply
undertow
I don't have an .htaccess file but I did remove this from site.php:
define('IS_DEV_SITE', true);
if (IS_DEV_SITE !== true) {
    define('BASE_URL', 'http://localhost:8888/concrete5.6.3.4/');
    define('LIVE_BASE_DOMAIN', BASE_URL);
}


However, pages other than the home still do not load. That's a great point about the Pretty URL's. Is there another way to force non-pretty urls?
hutman replied on at Permalink Reply
hutman
If you don't have a .htaccess file Pretty URLs should be off. If you try to go directly to the Dashboard can you get to it with /index.php/dashboard?

Could you provide a link to your site?
undertow replied on at Permalink Reply 1 Attachment
undertow
When I try to access the dashboard via the url then I get "an unexpected error occurred" message. When I login to the admin area and click on the dashboard then most of the page loads except for the links in the dashboard panel (see attached screenshot). There are a ton of page errors primarily involving missing js files.

The site is currently local but will eventually be migrated to a live server.
hutman replied on at Permalink Reply
hutman
Is your c5 install accessible athttp://localhost:8888/concrete5.6.3.4/... orhttp://localhost:8888/?

It seems weird that the site.php you had listed one but the error is the other. What do you see in your PHP error log?

Also, can you just confirm that your site has a /concrete/js/jquery.js?
undertow replied on at Permalink Reply
undertow
The site is accessible to me at:http://localhost:8888/concrete5.6.3.4/... and yes there is /concrete/js/jquery.js which is confusing since that resource is not loading.
hutman replied on at Permalink Reply
hutman
It's not loading because it's looking for it athttp://localhost:8888/concrete/js/jquery.js... nothttp://localhost:8888/concrete5.6.3.4/concrete/js/jquery.js...

Try adding these lines to the site.php

define('BASE_URL', 'http://localhost:8888');
define('DIR_REL', '/concrete5.6.3.4');
undertow replied on at Permalink Reply
undertow
Great catch! I've added the code to site.php, removed all files from files/cache and reloaded the browsers multiple times but it's still bypassing the root directory and instead trying to pull localhost:8888/concrete/js/jquery.js

Is there any other file/ location that would be affecting the site path?
hutman replied on at Permalink Best Answer Reply
hutman
Can you try going to /index.php/dashboard/system/seo/urls/ and turning off Pretty URLs if they are on, then try going to /index.php/dashboard/system/optimization/cache and turning off all caching, then go to /index.php/dashboard/system/optimization/clear_cache and clear the cache and see if any of that helps.

I'm not sure why else the DIR_REL wouldn't be working in the dashboard but those are the things I would start with. Then just double check that you don't have a .htaccess in the /concrete5.6.3.4 directory.

Also, I'm assuming this is not the case, but you don't have Varnish on your local environment, right?
undertow replied on at Permalink Reply
undertow
Wow! Subpages are now working! It looks like all "Unexpected Error..." messages are gone. So that must have been a pretty URL / cache issue. Thank you very much for your help directly accessing them worked perfectly.

Unfortunately, all is still the same with the dashboard. jquery.js isn't loading because it is skipping the root directory. What is odd to me is that jquery is loading properly when I'm editing a page but as soon as I click dashboard or any other admin area then the assets aren't loaded properly.

Is there a separate file that controls dashboard assets?

Also, I don't have varnish or any other cacheing in the local environment.
hutman replied on at Permalink Reply
hutman
Unfortunately I'm not sure exactly how the Dashboard loads, I know that it uses the header_required elements file, but I don't really know how it determines the URL to those files. I've try to search the forums and I just can't find anything on the subject.

I'm glad that your front end is working but I am pretty stumped on the Dashboard jquery thing, the only thing I can think of is that you have an add-on or customization that is causing it to load incorrectly.
buurvrouw replied on at Permalink Reply
buurvrouw
Are you sure your site should be placed inside an folder called 'concrete5.6.3.4'? This is not the regular file structure for concrete. Did you update your concrete install from the dashboard on your previous site location? If so, your folder 'concrete5.6.3.4' should live inside your_site_root/updates/

So you have your_site_root/concrete
And your_site_root/updates/concrete5.6.3.4

If this is the case, you should also have a line in your your_site_root/application/config/site.php like this:
define('DIRNAME_APP_UPDATED', 'concrete5.6.3.4');
undertow replied on at Permalink Reply
undertow
Hi Buuvrouw. I didn't have access/control over the site previously. I do already have the ‘DIRNAME_APP_UPDATED’ bit in my site.php

‘concrete5.6.3.4’ was just the initial root folder name for a blank C5 local install. It is the site’s root.

I currently do not have any folders or files living in the ‘updates’ folder.

Are you suggesting that the issue might be due to the root name and by changing the root directory folder name from ‘concrete5.6.3.4’ to anything else that it may solve the js load issue?
buurvrouw replied on at Permalink Reply
buurvrouw
Yes i think it does. When you already had this line in your site.php
define('DIRNAME_APP_UPDATED', 'concrete5.6.3.4');

it tells concrete5 to look in the updates folder for an updated core.

When downloading concrete5 from this site you have a folder called 'concrete5.x.x.x'. For a fresh install you should upload the contents of this folder, so not the folder itself.

In your root you have a folder called 'concrete' and a folder called 'updates' (and a bunch of more folders and files). The folder 'concrete' in your root is the core you initially installed. Inside your 'updates' folder concrete puts the downloaded updates, they look like 'concrete5.x.x.x' and inside them another folder called 'concrete':

root
-- concrete (your initial installed core)
-- updates
-- -- concrete5.x.x.x
-- -- -- concrete (the core c5 looks for from a dashboard update)

What you can try is this:
- If you have dashboard access, first turn off all caching functions and clear cache
- Move all your stuff from inside root/concrete5.6.3.4 to root.
- Then rename the concrete folder in your root to something like 'concreteOLD'.
- Download a new 5.6.3.4 version to make sure you have the right version from herehttp://www.concrete5.org/download....
- Take the folder 'concrete' from inside your downloaded folder and upload this folder to your root so you have a new concrete folder to run from.
- Make sure your current updates folder is empty.
- Clear the contents from root/files/cache
- And very important, remove this from your site.php:
define('DIRNAME_APP_UPDATED', 'concrete5.6.3.4');
define('BASE_URL', 'xxxxxxx');
define('DIR_REL', '/xxxxxx');

- Now run this line in your browser to update:
http://www.your-concrete5-site.com/index.php/tools/required/upgrade


This way you do a manual update, described here:http://legacy-documentation.concrete5.org/tutorials/manually-upgrad...

Before you do all the above make a backup! Also from your database.
undertow replied on at Permalink Reply
undertow
buurvrouw, Thanks for the detailed help. I wasn't able to successfully get this to work in my local dev environment- I still had .js issues with the dashboard and on other screens.

I started from scratch with a remote environment and migrate the site over. I was able to get the site mostly working by using a number of helpful tips from this thread.

In the end, I do think buurvrouw was correct that the root name of concrete5.6.3.4 was partially to blame for the issues. I find the file structure of C5 to be a bit confusing.

The one weird issue I'm still encountering on the remote site is that every screen in the admin area has an overlay (as if there was supposed to be a modal window- but the modal never loaded). This prevented me from clicking anything. I checked dev tools to see if a resource wasn't loading but everything loaded properly. My round-about fix was just to add this change to jquery.ui.css :
.ui-widget-overlay {
   display: none !important;
}


Thanks again to hutman and buurvrouw for all of the assistance. This is a great community.