“Use of undefined constant DS – assumed ‘DS'” Notice on Joomla

If you’re trying to migrate a Joomla website to the latest version, then it’s very possible for you to see the following notice:

Use of undefined constant DS – assumed ‘DS’ in …

The above notice stems from the fact that Joomla no longer makes a differentiation between Linux and Windows when it comes to file paths (Linux uses forward slashes [/] while Windows uses backslashes [\]), this is because Windows can now also read Linux file paths (in other words, Windows now also understands that a forward slash is a directory separator). Some references mistakenly claim that PHP automatically translates file paths from a Linux to a Windows format, hence the reason why Joomla removed the DS constant. This is wrong: while PHP has the DIRECTORY_SEPARATOR predefined constant which is automatically set to a forward slash or a backslash depending on whether you’re using Linux or Windows, it doesn’t automtically translate a directory path from Linux to Windows (or vice versa).

So what’s the exact cause of this problem?

The exact cause of the problem is that in previous versions of Joomla, there was a constant called DS (which stands for Directory Separator) that was set to the DIRECTORY_SEPARATOR PHP predefined constant. Joomla 3.x no longer defines this constant anywhere, and hence any extension using the DS Joomla constant will not work properly, because DS will be treated as the string “DS”. For example, this line:


will be equivalent to:


instead of:


Naturally, the required file will not exist and the extension (which is a template in our case) will fail. As you can see, a seemingly innocent notice can bring your whole website down!

So, what is a quick solution to the problem?

A very quick solution to the problem is to add the following line to the very top of the configuration.php or the index.php file:


The problem with this solution, however, is that any update to the site’s configuration will erase the above line if done in the configuration.php file, and any Joomla update may erase the above line if done in the index.php file.

Is there a better solution?

A better solution to the problem is to change any occurrence of DS to a / (forward slash) in the problematic extension. That should permanently solve the problem without modifying any core file.

Now, if the above solution didn’t work for you (or if you feel that it’s a bit too technical), then please contact us. Our fees are affordable, our work is professional, and we always have a solution to anything Joomla!

No comments yet.

Leave a comment