musicman
musicman

Reputation: 525

Symfony3: Developing in Windows, Deploying in Linux. DIRECTORY-SEPARATOR

I have following problem: I wrote a little homepage under Win10. All is fine but when I deploy my work in a Linux system I get the following message:

[2015-12-17 09:28:41] request.CRITICAL: Uncaught PHP Exception Twig_Error_Loader:
"The "/info/wwv/data/someone\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle/Resources/views" directory does not exist."
at /info/wwv/data/someone/vendor/twig/twig/lib/Twig/Loader/Filesystem.php line 94 [...]

I think there is some problem with the DIRECTORY_SEPARATOR or similar. The path exists and I can access it when I replace the backslashes with slashes.

Also my log is written in the directory app\logs instead real subdirectory app/logs.

Upvotes: 4

Views: 790

Answers (3)

Mahdi Rafatjah
Mahdi Rafatjah

Reputation: 1072

I had the same problem as my production server did not let me allocate enough ram to run composer and I had to run it locally.

Afterwards I got similar error (having wrong access path \ instead of / for linux) Steps I took:

  1. Replacing \\ with / in composer.json and composer.lock
  2. Clearing the var/cache/*

Upvotes: 0

Thomas Meyer
Thomas Meyer

Reputation: 1

I had a similar issue. One day symfony 3.4 (on php7.2.16) stops working. After changing some path settings in AppKernel.php from '/' to '\\', everything works fine.

e.g.

public function getLogDir()
{
   return dirname(__DIR__).'\\var\\logs';
}

It seems to be a windows-related issue with path-settings.

Upvotes: 0

Christophe Coevoet
Christophe Coevoet

Reputation: 999

Are you generating the cache on Windows and deploying the cache too instead of building it on the Linux server ? This is indeed not meant to work properly, due to differences between the OS. Recent versions of Symfony allow to build the cache before deployment and copy it to the other server, but this does not work with Windows on one side and Linux on the other.

Upvotes: 5

Related Questions