I have a symfony2 project running in my company's server (Debian for production, Ubuntu for development). We want to host another symfony2 web site in the same server, and we would like to keep both projects separated because they are not related each other and use different CSS styles.
I have defined two virtual hosts with subdomains pointing to each project's folder, but I can't keep both sites running together. It only runs the first one I load in a browser, and the second one shows this error:
ClassNotFoundException: Attempted to load class "RecAicragPromocionesBundle" from namespace "RecAicrag\PromocionesBundle" in /var/www/promociones/app/AppKernel.php line 19. Do you need to "use" it from another namespace?
It doesn't matter which one I load first, second one shows that error. I think there's a shared configuration somewhere, but I can't find how to solve it.. And I also can't find any example of how to host two projects in the same host.
If I can have two different configurations and CSS styles, I can consider keeping both sites in the same project, but I would prefer to keep them in different places.
My apache conf:
<VirtualHost *:80>
ServerAdmin carlos@xxx.com
ServerName localhost
DocumentRoot /var/www/
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
<VirtualHost *:80>
ServerAdmin carlos@xxx.com
ServerName intranet.localhost
DocumentRoot /var/www/intranet/web/
<Directory /var/www/intranet/web/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName promociones.localhost
ServerAdmin carlos@xxx.com
DocumentRoot /var/www/promociones/web/
<Directory /var/www/promociones/web/>
RewriteEngine On
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
First project:
app/config/routing.yml
xxx_intranet:
resource: "@XxxIntranetBundle/Resources/config/routing.yml"
prefix: /
src/.../Resources/config/routing.yml
intranet_consultas:
pattern: /consultas
defaults: { _controller: XxxIntranetBundle:Generico\Consultas:index }
intranet_consulta_articulo:
pattern: /consultas/articulo/{codigo}
defaults: { _controller: XxxIntranetBundle:Generico\Consultas:articulo }
......
xxx_intranet_Annotations:
resource: "@XxxIntranetBundle/Controller/"
prefix: /
type: annotation
Second (new):
app/config/routing.yml
rec_xxx_promociones:
resource: "@RecXxxPromocionesBundle/Resources/config/routing.yml"
prefix: /
src/.../Resources/config/routing.yml
rec_xxx_promociones_homepage:
pattern: /hello/{name}
defaults: { _controller: RecXxxPromocionesBundle:Default:index }
I have tried setting "host" parameter in routing.yml and nothing happens, still the same.