PHP Fatal error: require_once(): Failed opening required waktu diupload di hosting

Permisi kakak... Nubie mau tanya masalah config yg sy sudah buat,waktu dijalanin di localhost udah jalan dengan lancar, terus sy upload ke hosting dengan config seperti ini

 <?php
$page = (isset($_GET['page']) && $_GET['page']) ? $_GET['page'] : '';

// this configuration path for website
define('PATH', '/home/folder_user/public_html/demo/cms/'); // isi path dari website
define('SITE_URL', PATH . 'index.php');
define('POSITION_URL', PATH . '?page=' . $page);

// this configuration for database website
define('DB_HOST', 'localhost'); // host yang di gunakan
define('DB_USERNAME', 'root'); // username host
define('DB_PASSWORD', ''); // password host
define('DB_NAME', 'db_test'); // database yang di gunakan
?>

Untuk akses indexnya code nya sebagai berikut

 <?php
session_start();
// define configurations
define('ROOT', dirname(__FILE__));
define('DS', DIRECTORY_SEPARATOR);

// now require file
require_once "config.php";
require_once "library/database.class.php";
require_once "library/model.class.php";
require_once "library/view.class.php";
require_once "library/controller.class.php";

function __autoload($className) {

    $fileName = str_replace("\\", DS, $className) . '.php';

    if(!file_exists($fileName)) {

        return false;
    }

    include $fileName;
}

$page = (isset($_GET['page']) && $_GET['page']) ? $_GET['page'] : 'home';
$controller = ROOT . DS . 'modules' . DS . 'controllers' . DS . $page .'Controller.php';

if(!file_exists($controller)) {
print_r($controller);
    require_once $controller;
    $action = (isset($_GET['action']) && $_GET['action']) ? $_GET['action'] : 'index';
    $controllerName = ucfirst($page). 'Controller';

    $obj = new $controllerName();

    if(method_exists($obj, $action)) {

        $args = array();
        if(count($_GET) > 2){
            $parts = array_slice($_GET, 2);

            foreach ($parts as $part) {
                array_push($args, $part);
            }
        }
        call_user_func_array(array($obj, $action), $args);

    }else die('Action Not Found !');

}else print_r($controller);

Terus pesan errornya gini

 [21-Feb-2017 06:11:14 Asia/Jakarta] PHP Warning:  require_once(/home/folder_user/public_html/demo/cms/modules/controllers/homeController.php): failed to open stream: No such file or directory in /home/folder_user/public_html/demo/cms/index.php on line 32
[21-Feb-2017 06:11:14 Asia/Jakarta] PHP Fatal error:  require_once(): Failed opening required '/home/folder_user/public_html/demo/cms/modules/controllers/homeController.php' (include_path='.:/opt/alt/php56/usr/share/pear:/opt/alt/php56/usr/share/php') in /home/folder_user/public_html/demo/cms/index.php on line 32

Padahal didalam foldernya udah ada filenya, Salahnya yg dimana ya kakak terima kasih sebelumnya.

avatar cyrusrico
@cyrusrico

2 Kontribusi 4 Poin

Diperbarui 5 tahun yang lalu

5 Jawaban:

solved.. permasalah ada di ucfirst masing-masing untuk filename controller dan modelnya. thanks

avatar cyrusrico
@cyrusrico

2 Kontribusi 4 Poin

Dipost 7 tahun yang lalu

makasih udah share jawabannya, sangat membantu untuk teman-teman yang ada masalah yang sama, silahkan ditandai jadi jawaban yang benar

avatar hilmanski
@hilmanski

2670 Kontribusi 2132 Poin

Dipost 7 tahun yang lalu

saya juga mengalami hal yang sama , untuk ucfirst maksudnya seperti apa ? karna awal kaliman saya cek sudah benar yaitu huruf besar

avatar rianjunior
@rianjunior

1 Kontribusi 0 Poin

Dipost 5 tahun yang lalu

Mohon solusi perbaikan perubahannya bro ditampilkan, setting config.php sama index.php nya.. thnks. Binggung gak conect2 "Controller Not Found" teruuuuussss.. terimakasih

avatar t11u
@t11u

2 Kontribusi 0 Poin

Dipost 5 tahun yang lalu

ucfirst maksudnya hurufnya dibikin huruf besar <a href=' https://www.w3schools.com/php/func_string_ucfirst.asp '> https://www.w3schools.com/php/func_string_ucfirst.asp </a>

Kamu bisa ganti nama huruf controllernya jadi huruf besar.

avatar hilmanski
@hilmanski

2670 Kontribusi 2132 Poin

Dipost 5 tahun yang lalu

Login untuk ikut Jawaban