0
votes

I'm moving from a local environment that was working just fine to a shared hosting platform. Upon transferring all of my files, my site stopped work and I've traced the problem to the Session Start() command in my bootstrap file.

Here is the relevant code:

Bootstrap file:

require_once __DIR__ . '/../vendor/autoload.php';
require_once __DIR__ . '/functions.php';
require_once __DIR__ . '/connection.php';

$dotenv = new Dotenv\Dotenv(__DIR__);
$dotenv->load();


$session = new Symfony\Component\HttpFoundation\Session\Session();
$session->start();

app/config/config.yml:

session:
        handler_id:  session.handler.native_file
        save_path:   "%kernel.root_dir%/../var/sessions/%kernel.environment%"

Here is the error message I'm getting:

Warning: SessionHandler::read(): open(/var/php_sessions/sess_b03f80ce089ee5aaa887a02b006e76b0, O_RDWR) failed: No such file or directory (2) in /hermes/bosnaweb03b/b700/ipg.briangwaltney/YSC-Main/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/SessionHandlerProxy.php on line 61 Warning: SessionHandler::write(): open(/var/php_sessions/sess_b03f80ce089ee5aaa887a02b006e76b0, O_RDWR) failed: No such file or directory (2) in /hermes/bosnaweb03b/b700/ipg.briangwaltney/YSC-Main/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/SessionHandlerProxy.php on line 69

I have set the permissions to writable on all the folders that might apply.

One thing I've noticed is when I adjust the config.yml file, the error never changes. I've even tried using PDO Session Storage and still get the exact same error.

What am I doing wrong?

Thank you!

2
Stop using shared hosting to deploy symfony app, its possible but its a pain. Move on to hosting like Heroku or digitalocean, I used to use shared hosting for symfony but believe me it was no funBaig
I agree with @Baig. Can you pls show use directory structure where you have hosted the App?Gopal Joshi

2 Answers

0
votes

Change your config.yml specs for session to this:

framework:
    session:
        handler_id:  session.handler.native_file
        save_path:   "%kernel.root_dir%/../var/sessions/%kernel.environment%"
0
votes

Turns out it was a hosting problem. I was using iPage and they would not allow me to change the save path of the session. I switched to servergrove and it worked instantly with no modification.