require_once errors

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
deanaldo
Forum Newbie
Posts: 10
Joined: Thu Jul 02, 2009 2:55 pm

require_once errors

Post by deanaldo »

Having some trouble understanding this error my browser produces when I run a website locally:
PHP Warning: require_once(includes/joomla.php) [function.require-once]: failed to open stream: No such file or directory in C:\Websites\Webpage1\public_html\lifestyle\index.php on line 26 PHP Fatal error: require_once() [function.require]: Failed opening required 'includes/joomla.php' (include_path='.;C:\php5\pear') in C:\Websites\Webpage1\public_html\lifestyle\index.php on line 26 PHP Warning: require_once(includes/joomla.php) [function.require-once]: failed to open stream: No such file or directory in C:\Websites\Webpage1\public_html\lifestyle\index.php on line 26 PHP Fatal error: require_once() [function.require]: Failed opening required 'includes/joomla.php' (include_path='.;C:\php5\pear') in C:\Websites\Webpage1\public_html\lifestyle\index.php on line 26
The joomla file is in the includes directory and here is a copy of what line 26 is in the index.php:

Code: Select all

require_once( 'includes/joomla.php' );
Any help would be appreciated, thanks
Eric!
DevNet Resident
Posts: 1146
Joined: Sun Jun 14, 2009 3:13 pm

Re: require_once errors

Post by Eric! »

It looks like your path isn't right. Either specify the full path in the include or add the path to the file into your include list which is only '.' and 'c:/php5/pear' right now.

Code: Select all

$path = '/my/path/includes';
set_include_path(get_include_path() . PATH_SEPARATOR . $path);
You can also use the .htaccess to set the include path if you're running apache
deanaldo
Forum Newbie
Posts: 10
Joined: Thu Jul 02, 2009 2:55 pm

Re: require_once errors

Post by deanaldo »

Just to note I am using IIS 7, I've fiddled around a bit and I'm now getting this error

Code: Select all

PHP Warning: require_once(/home/lifestyl/public_html/lifestyle/includes/version.php) [function.require-once]: failed to open stream: No such file or directory in C:\Websites\webpage1\public_html\lifestyle\includes\joomla.php on line 71 PHP Fatal error: require_once() [function.require]: Failed opening required '/home/lifestyl/public_html/lifestyle/includes/version.php' (include_path='.;C:\PHP\pear') in C:\Websites\webpage1\public_html\lifestyle\includes\joomla.php on line 71
Here is the code on line 71 in joomla.php

Code: Select all

require_once( $mosConfig_absolute_path . '/includes/version.php' );
The version file is in the includes folder so I'm guessing there is some path issue, any ideas?
deanaldo
Forum Newbie
Posts: 10
Joined: Thu Jul 02, 2009 2:55 pm

Re: require_once errors

Post by deanaldo »

Still stuck with this :x Anybody able to help? Much appreciated thanks
User avatar
turbolemon
Forum Commoner
Posts: 70
Joined: Tue Jul 14, 2009 6:45 am
Location: Preston, UK

Re: require_once errors

Post by turbolemon »

Does C:\Websites\Webpage1\public_html\lifestyle\includes\joomla.php exist? Also, you may need to replace the require path:

Code: Select all

require_once( 'includes/joomla.php' );
to

Code: Select all

define( 'DS', DIRECTORY_SEPARATOR ); //only if it's not already defined!
 
require_once( 'includes'.DS.'joomla.php' );
Seems you are using Joomla 1.0, any reason for not upgrading to 1.5? They cut official support for 1.0 in 7 days.

Check the configuration.php file to see if there are any hard-coded paths (if it has one, i did very little development in 1.0).
Post Reply