php - How can I create separate web directories for each application in symfony? -
For example, I have two applications: 'frontend' and 'backend'. I want to set up my / web directory so that '/ web / frontend' works in 'frontend' property, and '/ web / backend' all image paths need to be modified without 'backend' in property Works, etc.
, each application should do this by doing this in config.php [Example apps are showing / Backend / config / config.php]
sfConfig :: add (array ('sf_web_dir' = & gt; SF_ROOT_DIR '/ web / backend', 'sf_upload_dir' = & gt; SF_ROOT_DIR '/ Web / backend' sf config: find ('sf_upload_dir_name'),));
For some reason, this method does not work. If you take a look at all variables defined in sfConfig, then you will see that you have to change sf_web_dir and work to get more than sf_upload_dir.
An option will manually override all the variables inside sfConfig which will point to the Web directory in each app's config.php. To see a list of all variables,
& lt; Try php echo var_dump (sfConfig :: getall ()); ? & Gt;
Your second choice (the way I have done before) in Apache configuration, will be visible to your virtual host settings for backend such as
& Lt; VirtualHost * & gt; Server name backend.dev DocumentRoot "PATH_TO_SYMFONY_PROJECT / Web / Backend" DirectoryIndex index.php aka / sf / usr / local / lib / php / data / symphony / web / sf & lt; Directory "/ usr / local / lib / php / data / symphony / web / sf" & gt; Allow override Allow all to everyone & gt; Directory & gt; & Lt; Directory "PATH_TO_SYMFONY_PROJECT / Web / Backend" & gt; Allow override Allow all to everyone & gt; Directory & gt; & Lt; / VirtualHost & gt;
Then you will need to copy backend.fp, backend_dev.fp [and possibly index.ppp) if backend is your webmaster backend] / web / backend, and from those files In each, change
define ('SF_ORO_DIR', actual path (dima name (__ file __). '/ ..')); Define ('sf_oro_dir', actual path (dima name (__ file __) '/ .. / ..'));
And you should be good I like this method, but if you do not have Virtual Host setup, you do not have this option.
Comments
Post a Comment