2

We have moved web hosting provider and moved our joomla website and database across.

When trying to access the front end of the website, I get the error:

Warning: require_once(JPATH_BASE/libraries/import.legacy.php): failed to open stream: No such file or directory in /home/xxx/public_html/includes/framework.php on line 15

Fatal error: require_once(): Failed opening required 'JPATH_BASE/libraries/import.legacy.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/xxx/public_html/includes/framework.php on line 15

I have checked that the import.legacy.php file is in the stated directory and the permissions are 644.

The output of JPATH_BASE is /home/xxx/public_html

How can I fix this error?

Community
  • 1
  • 1
KEmu
  • 21
  • 1
  • 3
  • it looks like `JPATH_BASE` is not defined and interpreted as a string. Don't know Joomla, not sure what to suggest. There may be similar issues out there though, when searching the error message, would try that. – Pekka Feb 28 '17 at 10:28

3 Answers3

2

Change your require_once statement to

require_once(JPATH_BASE . '/libraries/import.legacy.php')
James Walker
  • 795
  • 2
  • 6
  • 22
  • The statement was **require_once (JPATH_LIBRARIES . '/import.legacy.php');** and when I changed the statement as suggested it fixed the error but now gives me the same error for a different file. Do you suggest changing them all? – KEmu Feb 28 '17 at 10:40
  • Yes I would as it fixed the current error. You can use your IDE to do a "search and replace in files" which will find all the occurrences of the old code and update it with the new code. – James Walker Feb 28 '17 at 12:24
  • What is the output of `JPATH_LIBRARIES`? It seems like in one place that one has a wrong definition. – fragmentedreality Feb 28 '17 at 14:29
0

Make sure your PHP version is greater than 5.3 and also you have right permission on the files to include in some other file.

  • How does this relate to the question? The error-message makes it obvious, that `JPATH_BASE` is not resolved to anything but just used as part of the include-path. This has nothing to do with the PHP version. – fragmentedreality Feb 28 '17 at 14:19
  • Both import.legacy.php and framework.php file are from core Joomla and you are not supposed to find and replace the code in each files. If you upgrade to the new Joomla version in future, all the changes you made will be overwritten by the new version files. You cannot find and replace the code every time.JPATH_LIBRARIES is a predefined constant in Joomla. Even I have faced the same problem and tried changing the permission of the files and folders and it fixed my problem. Also on some other server we upgraded the PHP version it also worked for me. Not necessary to touch the core files at all. – Karthikeyani Srijish Mar 01 '17 at 07:32
  • Refer https://forum.joomla.org/viewtopic.php?t=837896 & http://stackoverflow.com/questions/18428789/joomla-php-error-message – Karthikeyani Srijish Mar 01 '17 at 07:33
0
$ require_once(JPATH_LIBRARIES.'/joomla/document/html/renderer/head.php');

Disable or remove the above line and add this:

$header_contents = ‘’;
if(!class_exists(‘JDocumentRendererHead’)) {
    $head = JPATH_LIBRARIES . ‘/joomla/document/html/renderer/head.php’;
    if(file_exists($head)) {
        require_once($head);
    }
}
Stephen Kennedy
  • 20,585
  • 22
  • 95
  • 108