3

I'm using Joomla 3.5.1 . Recently I install phoca gallery on my joomla. It does not work and unfortunately I can not uninstall it from extensions or plugin menu. When I click on extension-management menu, I get this error:

Warning: require_once() [function.require-once]: Unable to access /home/aiprogra/public_html/administratorDScomponentsDScom_phocagalleryDSlibrariesDSloader.php in /home/aiprogra/public_html/plugins/content/phocagallery/phocagallery.php on line 20

Warning: require_once(/home/aiprogra/public_html/administratorDScomponentsDScom_phocagalleryDSlibrariesDSloader.php) [function.require-once]: failed to open stream: No such file or directory in /home/aiprogra/public_html/plugins/content/phocagallery/phocagallery.php on line 20

Fatal error: require_once() [function.require]: Failed opening required '/home/aiprogra/public_html/administratorDScomponentsDScom_phocagalleryDSlibrariesDSloader.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/aiprogra/public_html/plugins/content/phocagallery/phocagallery.php on line 20

How can I fix this error? I Noted that I'm not a php progammer. I prefer to uninstall it.

1
  • Babak, you now have the privilege to vote in our current moderator election. Please exercise your new democratic privilege. May 6, 2021 at 4:05

1 Answer 1

1

Background

DS is a constant that stands for Directory Separator, and was used in earlier versions of Joomla in order to differentiate between forward slash / and backslash \. In short, this has to do with the fact that Linux systems (like Apache servers) use forward slash to separate directories, while Windows uses backslash as directory separator. However, Windows is just as happy with forward slash, so the DS constant is not defined by default in Joomla anymore. This causes errors in extensions that still use the constant.

Your problem

The Phoca Plugin uses the following code to include a file from the main Phoca Gallery component:

require_once( JPATH_ADMINISTRATOR.DS.'components'.DS.'com_phocagallery'.DS.'libraries'.DS.'loader.php');

Since DS has not been defined, PHP translates this as:

require_once('/home/aiprogra/public_html/administratorDScomponentsDScom_phocagalleryDSlibrariesDSloader.php')

This file does not exist, and the actual path should have been:

/home/aiprogra/public_html/administrator/components/com_phocagallery/libraries/loader.php

Hence the error.

Solutions

There are a couple of ways to solve this:

  1. Download a small plugin called DS Constant for Joomla! 3.0 that defines the constant. I haven't tested the plugin myself, but it should work fine.

  2. Change the plugin code (in this case the file is ROOT/plugins/content/phocagallery/phocagallery.php, line 20), replacing any occurrence of DS with a forward slash. This requires some basic PHP knowledge in order to get the quotes right.

  3. Define the constant yourself, adding the following line in the file ROOT/index.php:

    define('DS', DIRECTORY_SEPARATOR);
    

    However this is a core hack and not recommended, since your site will break when you update Joomla.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.