Skip to content

Commit 5f6127e

Browse files
committed
Added a Troubleshooting section to the main deployment article
1 parent 6d25dbb commit 5f6127e

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

deployment.rst

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,36 @@ Don't forget that deploying your application also involves updating any dependen
207207
(typically via Composer), migrating your database, clearing your cache and
208208
other potential things like pushing assets to a CDN (see `Common Post-Deployment Tasks`_).
209209

210+
Troubleshooting
211+
---------------
212+
213+
Deployments not Using the ``composer.json`` File
214+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
215+
216+
Symfony applications provide a ``kernel.project_dir`` parameter and a related
217+
:method:`Symfony\\Component\\HttpKernel\\Kernel\\Kernel::getProjectDir>` method
218+
so you can perform file operations relative to your project's root directory.
219+
The logic to find that directory is based on the location of the
220+
``composer.json`` file.
221+
222+
If your deployment method doesn't use Composer, you may have removed the
223+
``composer.json`` file and the application won't work on the production server.
224+
The solution is to override the ``getProjectDir()`` method in the application
225+
kernel and return your project's root directory::
226+
227+
// app/AppKernel.php
228+
// ...
229+
class AppKernel extends Kernel
230+
{
231+
// ...
232+
233+
public function getProjectDir()
234+
{
235+
return __DIR__.'/..';
236+
}
237+
}
238+
239+
210240
.. _`Capifony`: https://github.com/everzet/capifony
211241
.. _`Capistrano`: http://capistranorb.com/
212242
.. _`sf2debpkg`: https://github.com/liip/sf2debpkg

0 commit comments

Comments
 (0)