0

First of all, I know this is a duplicate, but I couldn't find a solution in the other topics.

My PHP Application is running with no issue on my localhost, but whenever I upload it to a Web Server, I get -

500 Internal Server Error   

Using some of the answers found on Stack Overflow such as using ini_set('display_errors', 1); to generate the following error:

Warning:require_once(/home/users/web/b2365/nf.storyboardclubcom/public_html/beta/classes/Cookie.php): failed to open stream: No such file or directory in /hermes/bosnaweb04a/b2365/nf.storyboardclubcom/public_html/beta/core/init.php on line 28 Fatal error: require_once(): Failed opening required '/home/users/web/b2365/nf.storyboardclubcom/public_html/beta/classes/Cookie.php' (include_path='.:/usr/local/lib/php-5.5.22-amd64/lib/php') in /hermes/bosnaweb04a/b2365/nf.storyboardclubcom/public_html/beta/core/init.php on line 28

Naturally I checked and I can confirm that these files exist in their respective folders on the server, and all permissions have been set correctly (755 on folders, and 644 on files).

Here is my code below for my initialization file:

ini_set('display_errors', 1);
// Starting a session for users
session_start();

// Global Configuration
$GLOBALS['config'] = array(
'mysql' => array(
    'host' => 'localhost',
    'username' => 'root',
    'password' => '',
    'db' => 'storyboardclub'
    ),

'remember' => array(
    'cookie_name' => 'hash',
    'cookie_expiry' => 604800
    ),

'session' => array(
    'session_name' => 'user',
    'token_name' => 'token'
    )
);

spl_autoload_register(function($class) {
require_once $_SERVER['DOCUMENT_ROOT'] . '/beta/classes/' . $class . '.php';
});

require_once $_SERVER['DOCUMENT_ROOT'] .  '/beta/functions/sanitize.php';

if(Cookie::exists(Config::get('remember/cookie_name')) && 
   !Session::exists(Config::get('session/session_name'))) {
    $hash = Cookie::get(Config::get('remember/cookie_name'));
    $hashCheck = DB::getInstance()->get('sessions', array('session_hash', '=', $hash));

    if($hashCheck->count()) {
        $user = new User($hashCheck->first()->session_user_id);
        $user->login();
    }
}

Any help on this matter would be much appreciated

LoïcR
  • 4,940
  • 1
  • 34
  • 50
Khaled
  • 154
  • 2
  • 8
  • check case also for file name. If sever is case sensitive then may be this issue occur . – B. Desai Apr 27 '17 at 09:31
  • Thank you, it was the solution I was looking for. Once the files have been re-named correctly, everything worked like a charm. Much appreciated. – Khaled Apr 27 '17 at 09:47
  • Filenames are case sensitive on a unix and not case sensitive on a windows box. Suggestion to developers is always use lowercase names for filenames, then you will never need to worry about this again – RiggsFolly Apr 27 '17 at 09:57
  • Possible duplicate of [PHP - Failed to open stream : No such file or directory](http://stackoverflow.com/questions/36577020/php-failed-to-open-stream-no-such-file-or-directory) – The Hungry Dictator Apr 27 '17 at 12:45

1 Answers1

0

You need to copy Cookie.php file to the /home/users/web/b2365/nf.storyboardclubcom/public_html/beta/classes/ directory.

Ilya Kovalyov
  • 484
  • 2
  • 10
  • I can confirm that cookie.php does in fact exist under classes directory, with 644 permission. – Khaled Apr 27 '17 at 09:29
  • File name is case sensitive. It should be exact Cookie.php, not cookie.php – Ilya Kovalyov Apr 27 '17 at 09:32
  • Thank you, it was the solution I was looking for. Once the files have been re-named correctly, everything worked like a charm. Much appreciated. – Khaled Apr 27 '17 at 09:47