Advertisement

Leave $live_site='' in Joomla configuration.php Topic is solved

Need help with the Administration of your Joomla! 4.x site? This is the spot for you.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10
Locked
sozzled
I've been banned!
Posts: 13639
Joined: Sun Jul 05, 2009 3:30 am
Location: Canberra, Australia

Leave $live_site='' in Joomla configuration.php

Post by sozzled » Sat Dec 10, 2022 9:35 pm

There's a setting in the J! configuration file that has been there since J! 1.0; in a brand-new J! 4.x installation you will find it at around line 40 and it looks like this

Code: Select all

	public $live_site = '';
There is no mechanism within Joomla that allows a website owner to change this value. If people have a different value for $live_site it is because they have edited the file configuration.php themselves.

There are literally hundreds of posts on this forum that discuss problems people have with using a non-null value for $live_site. Hundreds of posts! So, why do people use a non-null value for $live_site? ???

As Tim Davis explains in a video presentation (https://www.[youtube].com/watch?v=nCsfJam6DX8) a few years ago, there may have been a reason for using $live_site but no-one seems to know why it's there today.

In general, there are two main reasons for editing the file configuration.php. One of those reasons is if you're locked-out from the backend of your website and you need to enable J! debug mode; the other main reason is to verify (or change) the database credentials. In general there should be no other reason to change this file. Neither of these situations involves changing $live_site. Again, we have to ask the question, for what other reason do people edit configuration.php?

There are not many places on the internet where the $live_site setting is properly explained. The J! documentation site discusses the "need" to change $live_site:
Have You Moved Domains?

Sometimes if you have changed domains (for example, from a localhost or test environment to the live domain), you will need to edit the value for the $live_site variable in the configuration.php file found in the root directory of your Joomla site files. The value of the variable must be manually edited, it cannot be accessed via the Global Configuration screens.

Typically, it would look like:

Code: Select all

var $live_site = 'https://example.com';
Or, if you access your website in a sub-folder called joomla, it would be like this:

Code: Select all

var $live_site = 'https://example.com/joomla';
When you move domains, this value may need updating to reflect your new domain name:

Code: Select all

var $live_site = 'https://mynewdomain.com';
Often there is no need to specify this variable at all. Simply leave it blank:

Code: Select all

var $live_site = '';
There are a lot of assumptions here. The first assumption is that there exists a non-null value for $live_site, "typically" appearing as

Code: Select all

var $live_site = 'https://example.com';
That assumption is false if the website being moved from one hosted environment to another (or one domain to another) had a non-null value there in the first place. If the original website is a brand-new, "out-of-the-box" J! 4.x (or J! 3.x) website, the configuration.php file contains the line

Code: Select all

	public $live_site = '';
Secondly, the documentation is outdated. The PHP file does not use var declarations; it uses public declarations. I'm not sure when the change occurred but it was around the time of J! 3.5, I think (about six years ago) and the doco hasn't been updated to reflect this change.

Thirdly, even on PC-hosted websites, there would typically be no need for a non-null value for $live_site and, therefore, no need to change this when deploying the site to a commercially-hosted environment.

In A Guided Tour of Joomla's configuration.php File, $live_site is discussed here:
$live_site: In the newest versions this should not have a value. There may be times you do need to fill in a value. If you are redirecting a URL you need to put the actual URL to the live site on this line. Or if you are creating a copy of a site for testing and modification. For example, I have a test site at https://dashhelp.com/joomla17 which is a copy of my main site. I had to change this to line in the configuration.php file on the copy. You will get a page not found error if this is not set to 'https://yourdomain.com/directory" or in the case of a subdomain "https://subdomain.yourdomain.com" Joomla uses this URL to create relative paths. Essential to check this on test sites.
I agree that it's essential to check this setting on test sites; it's essential to check this setting on all J! 4.x (or J! 3.x) websites because you will probably find that there is no need to have anything other than an non-null value for this setting. The above article was written nearly 3½ years ago and some of the advice that it contains may be outdated. In effect, $live_site may be useful in situations where the website is hosted on a badly-configured server—which is a point made in the video I mentioned earlier—but there is no apparent reason why people need to change this value.

Again we return to the question, why do people change something that can't be changed under normal circumstances? What advice are people reading that instructs them to make these kinds of changes? I don't know the answers to these questions and I believe most experts would agree that there's no benefit in changing $live_site.

If someone can show us a real life example of how changing $live_site to a non-null value has made a positive improvement to their J! 4.x experience, I would be fascinated to see how this happened. My advice is to leave $live_site alone or, if it has a non-null value, change it to a null value.

Advertisement
sozzled
I've been banned!
Posts: 13639
Joined: Sun Jul 05, 2009 3:30 am
Location: Canberra, Australia

Re: Leave $live_site='' in Joomla configuration.php

Post by sozzled » Fri Jan 06, 2023 7:01 pm

One reason why we've seen a number of people having $live_site with a non-empty value is because of the way they've restored their websites using Akeeba Backup.

After using Akeeba Kickstart to decompress the [Akeeba Backup] .JPA file, a new window opens and runs a slightly different form of the J! installation procedure. On the second screen of this "installation" (see https://www.akeeba.com/documentation/ak ... setup.html) you will see a screen like this:

Image

Note the fourth input text box labelled Live Site URL. This should be left empty. If you hover your mouse over label, you may see a warning, as shown below:

Image

We now know the reason why a number of people have websites with $live_site = 'something'. There is more information about how this arises if you read the discussion at viewtopic.php?f=808&t=998528.

In summary, check the configuration.php file for the value of $live_site and make sure the line looks like this:

Code: Select all

	$live_site = '';

frostmakk
Joomla! Explorer
Joomla! Explorer
Posts: 262
Joined: Sun Dec 28, 2014 9:30 am
Location: Stavanger, Norway

Re: Leave $live_site='' in Joomla configuration.php

Post by frostmakk » Fri Jan 06, 2023 9:04 pm

sozzled wrote: Sat Dec 10, 2022 9:35 pm My advice is to leave $live_site alone or, if it has a non-null value, change it to a null value.
Please don't use terms like null and non-null values when explaining this. It's wrong and confusing.

This is a null value:
public $live_site = NULL;

This is a string, and it is a non-null value:
public $live_site = 'something';

This is an empty string, and as far as the programming language this is written in is concerned, also a non-null value:
public $live_site = '';

My advice is that the value of $live_site in configuration.php should be an empty string represented by two single quotation marks.

sozzled
I've been banned!
Posts: 13639
Joined: Sun Jul 05, 2009 3:30 am
Location: Canberra, Australia

Re: Leave $live_site='' in Joomla configuration.php

Post by sozzled » Sat May 20, 2023 12:05 am

I updated the documentation (referenced earlier) to include a warning about $live_site.

kuentabazura
Joomla! Apprentice
Joomla! Apprentice
Posts: 10
Joined: Tue Aug 15, 2023 2:21 am

Re: Leave $live_site='' in Joomla configuration.php

Post by kuentabazura » Thu Aug 24, 2023 2:37 pm

I have stumbled across this topic and wonder if this is related to my problem with Joomla 4 upgrade here:
viewtopic.php?f=811&t=1003361&p=3699964#p3699964
Read on.

As for the "live site", in my configuration.php it contains the actual website with https://www.WEBSITE.com/
If I delete the value and set it to ' ' (empty), functions break: I cannot use Akeeba to restore a backup anymore (causing an error with AJAX) and I cannot use the Joomla update (causing an unknown server error). These two things I encountered. (also see the screenshot for error notifications)

As for my issue as it may be related, the ULR misses the /administrator/ part when refreshing the backend from anything like cache clearing or confirming messages or updating things since upgrading to Joomla 4 from J3. So far no solution. If I change the value from https://www.WEBSITE.com to www.WEBSITE.com, the URL after refreshing/updating settings adds ..../administrator/www.WEBSITE.com/administrator/....

In case it helps anyone (and myself).
You do not have the required permissions to view the files attached to this post.

Advertisement

Locked

Return to “Administration Joomla! 4.x”