Reputation: 2375
I am running a Symfony 3 app on my local wondows machine. It's served with a XAMPP server. The app runs fine when i visite my local URL. The problems is that I can't seem to be able to run it in the dev envirement.
The Symfony app folder structure is diffrent then what I am used to. The app_dev.php is located in the intranet folder.
This is the intranet folder
My current apache config file looks like this:
<VirtualHost *:443>
ServerName quebecenreseau.ca
ServerAlias www.quebecenreseau.ca
SSLEngine on
SSLCertificateFile "crt/quebecenreseau.ca/server.crt"
SSLCertificateKeyFile "crt/quebecenreseau.ca/server.key"
DocumentRoot C:\xampp\htdocs\quebecenreseau
<Directory C:\xampp\htdocs\quebecenreseau>
AllowOverride All
Order Allow,Deny
Allow from All
</Directory>
# uncomment the following lines if you install assets as symlinks
# or run into problems when compiling LESS/Sass/CoffeeScript assets
# <Directory /var/www/project>
# Options FollowSymlinks
# </Directory>
ErrorLog C:\xampp\apache\logs\project_error.log
CustomLog C:\xampp\apache\logs\project_access.log combined
</VirtualHost>
I am unsure how to configure the VirtualHost block in order to get the dev envirement working on both, the root directory as well as the intranet directory that serves as the admin of the website.
If I change the DocumentRoot line like so:
DocumentRoot C:\xampp\htdocs\quebecenreseau\intranet\app_dev.php
My app CSS files are not loaded and my intranet is served at the root level. How can I configure my local envirement to load app_dev.php? Also, my prod envirement is on a centos server so I really don't wana mess with the prod envirement.
In case you wander whats inside the index.php file at the root level here it is:
<?php
/**
* Start session
*/
session_start();
/**
* Load configuration and router
*/
require 'classes/Router.php';
require 'classes/Database.php';
require 'classes/Main.php';
/**
* Load helpers
*/
require 'helpers/phpmailer/class.phpmailer.php';
require 'helpers/GUMP.php';
require 'helpers/MailChimp.php';
/**
* Load models
*/
require 'models/Article.php';
require 'models/Formation.php';
require 'models/SAE.php';
/**
* Load routes
*/
require 'router.php';
/**
* Match requests
*/
$match = $router->match();
if( $match && is_callable( $match['target'] ) ) {
// call function related to matched route
call_user_func_array( $match['target'], $match['params'] );
} else {
// no route was matched
header( $_SERVER["SERVER_PROTOCOL"] . ' 404 Not Found');
}
Upvotes: 3
Views: 645
Reputation: 544
Try to change C:\xampp\htdocs\quebecenreseau
to C:\xampp\htdocs\quebecenreseau\intranet\web
. if I remember well, the document root must point to the folder where app.php and app_dev.php are located.
UPDATE:
Ok. It is a bit more clear now. You are not running a pure Symfony project in the prod. Someone took some basic classes from Symfony and used to route requests and handle DB connections.
Right now you have actually two projects. A plain PHP project in the main folder and a Symfony project in the intranet folder.
So let's start working on it. First, you have to know that for a Symfony project to work properly as the main application, the root folder must be the "web" folder.
So:
From what I see from the structure, you will need to do minimal changes to make it work.
Upvotes: 2