Question

I have a joomla website and I am creating a photo gallery with a .php calling the pictures with a query1 SELECT (this php runs out of joomla but call the pictures from the joomla DB)

When the gallery.php is at the root of my website, it's working fine. But when I want to insert it in a folder then I get this error :

Warning: require_once(/homez.420/xxxxx/www/gallery/includes/defines.php) [function.require-once]: failed to open stream: No such file or directory in /homez.420/xxxxx/www/gallery/gallery.php on line 30

Fatal error: require_once() [function.require]: Failed opening required '/homez.420/xxxxx/www/gallery/includes/defines.php' (include_path='.:/usr/local/lib/php') in /homez.420/xxxxx/www/gallery/gallery.php on line 30

I am still new to php and I can't get a way to find how to make those two lines jump out of the gallery folder so that it call this document instead : /homez.420/xxxxx/www/includes/defines.php

require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' );
require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' );

Here is the full code

<?php
define( '_JEXEC', 1 );
define('JPATH_BASE', dirname(__FILE__) );  //this is line 30 : where the glitch is 
define( 'DS', DIRECTORY_SEPARATOR );

require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' );
require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' );

$mainframe =& JFactory::getApplication('site');
$mainframe->initialise();
$db = &JFactory::getDBO();
?>

Thanks a lot for your help!

Was it helpful?

Solution

The solution was simple : replace line 30 :

define('JPATH_BASE', dirname(__FILE__) );

by website root path:

define('JPATH_BASE', '/homez.420/xxxxxxx/www');
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top