Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

PHP Fatal error: require()

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Bugs
View previous topic :: View next topic  
Author Message
zgluis
Smarty n00b


Joined: 13 Jan 2016
Posts: 1

PostPosted: Wed Jan 13, 2016 1:31 pm    Post subject: PHP Fatal error: require() Reply with quote

I have a website that works perfect in my localhost with xampp, but... I uploaded it to a few free websites hosting (000webhost and hostinger) and when i try to open it, got this message:

Quote:
Warning: require(core/libs/smarty/Smarty.class.php): failed to open stream: No such file or directory in /home/u327900732/public_html/www/index.php on line 7

Fatal error: require(): Failed opening required 'core/libs/smarty/Smarty.class.php' (include_path='.:/opt/php-5.5/pear') in /home/u327900732/public_html/www/index.php on line 7

This is the code:

Code:
<?php   

session_start();

$view = isset($_GET['view']) ? $_GET['view'] : 'index';

require_once('core/libs/smarty/Smarty.class.php');
require('core/models/class.Conexion.php');

if(file_exists('core/controllers/'.$view.'Controller.php')){
    include('core/controllers/'.$view.'Controller.php');
}else {
    include('core/controllers/errorcontroller.php');
}

?>


I checked that file one hundred times and it is there.

I found and tried this solutions:

Changing Require for Include:
Quote:

Warning: include(core/libs/smarty/Smarty.class.php): failed to open stream: No such file or directory in /home/u327900732/public_html/www/index.php on line 7

Warning: include(): Failed opening 'core/libs/smarty/Smarty.class.php' for inclusion (include_path='.:/opt/php-5.5/pear') in /home/u327900732/public_html/www/index.php on line 7

Fatal error: Class 'Smarty' not found in /home/u327900732/public_html/www/core/controllers/indexController.php on line 3


require(chdir(dirname(FILE)) . 'core/libs/smarty/Smarty.class.php');

Quote:
Warning: require(1core/libs/smarty/Smarty.class.php): failed to open stream: No such file or directory in /home/u327900732/public_html/www/index.php on line 7

Fatal error: require(): Failed opening required '1core/libs/smarty/Smarty.class.php' (include_path='.:/opt/php-5.5/pear') in /home/u327900732/public_html/www/index.php on line 7

Changing line 7 for
require_once($_SERVER['DOCUMENT_ROOT'].'/core/libs/smarty/Smarty.class.php');

Quote:
Warning: require_once(/home/u327900732/public_html/core/libs/smarty/Smarty.class.php): failed to open stream: No such file or directory in /home/u327900732/public_html/www/index.php on line 7

Fatal error: require_once(): Failed opening required '/home/u327900732/public_html/core/libs/smarty/Smarty.class.php' (include_path='.:/opt/php-5.5/pear') in /home/u327900732/public_html/www/index.php on line 7


I tried adding './' to the path but it still doesn't work. I repeat, the site works perfect in my localhost. Hope you can help me, please!
[/quote]
Back to top
View user's profile Send private message Send e-mail
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Wed Jan 13, 2016 11:53 pm    Post subject: Reply with quote

This is not a bug in Smarty, this is a bug in your code.
You're incorrectly using paths.
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Bugs All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP