The problem is I see trace error pages in production mode, in Symfony app.
I have this in app.php:
$kernel = new AppKernel('prod', true);
And I have done:
php app/console cache:clear --env=prod
Ok, I was completely wrong! The purpose of the second parameter in $kernel = new AppKernel('prod', true); is to enable/disable the debug mode. You can read the doc here: https://symfony.com/doc/current/configuration/environments.html
The issue was solved by setting to false the debug mode.
Related
I know that this is not the first post about this question, but I do it because others answers didn't solve my problem.
I tried the basic :
$kernel = new AppKernel('prod', true);
But this is not the good way to do it because I still have Symfony errors...
I don't know how to rewrite errors pages :
http://le-blog-etudiant.fr/blablabla
Do you know if this Symfony error is caused by the fact that my website is still in dev mode or because my error.html.twig page doesn't work ?
EDIT 1 :
I'm using app.php on my site, I set $kernel = new AppKernel('prod', false); and I did the command : php bin/console cache:clear --env=prod but it still display Symfony's errors
Because you need to do this :
$kernel = new AppKernel('prod', false);
Here is the constructor of AppKernel :
/**
* Constructor.
*
* #param string $environment The environment
* #param bool $debug Whether to enable debugging or not
*/
public function __construct($environment, $debug)
Permission denied here showing your problem http://le-blog-etudiant.fr
You have to give permission
chmod 777 -R var/cache
chmod 777 -R var/cache/*
Other problems then we will check...
I cannot disable Symfony3 cache for my project, can you please help me?
Things that I already tried to do:
commenting the line $kernel->loadClassCache(); in web/app_dev.php
adding
twig:
cache: false
to config_dev.yml
My $kernel instantiation in app_dev.php: $kernel = new AppKernel('dev', true);
after working with my project on dev mod, i found some problems with prod on OVH.
it shows me a blank page ! i try to follow the issue on app.php and i found that the problem persist with the execution of $response = $kernel->handle($request); and it don't logging on prod.
so when i change the row on app.php : $kernel = new AppKernel('prod', false); with $kernel = new AppKernel('dev', false); it works well !!!
here's my app.php
<?php
/*
* This file is part of the Sonata package.
*
* (c) Thomas Rabaix <thomas.rabaix#sonata-project.org>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
umask(0000);
require_once __DIR__ . '/../app/bootstrap.php.cache';
require_once __DIR__ . '/../app/AppKernel.php';
//use Symfony\Component\HttpFoundation\Request;
// if you want to use the SonataPageBundle with multisite
// using different relative paths, you must change the request
// object to use the SiteRequest
use Sonata\PageBundle\Request\SiteRequest as Request;
$request = Request::createFromGlobals();
$kernel = new AppKernel('prod', false);
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);
EDIT :
in dev and prod local mode test it works well with
php app/console cache:clear --env=prod --no-debug
php app/console assets:install web_directory
php app/console assetic:dump web_directory
should i add or install php5 on my project ?
EDIT :
my project contains : sonata-project, fosUserBundle,etc...
EDIT
the problem was on config_prod.xml
doctrine:
orm:
entity_managers:
default:
metadata_cache_driver: apc
query_cache_driver: apc
result_cache_driver: apc
intil now after it return an error 500 ! why ? because of apc was not enabled !
so my question how to enable apc on OVH pro !
Go to web/config.php and comment ot the following lines:
if (!in_array(#$_SERVER['REMOTE_ADDR'], array(
'127.0.0.1',
'::1',
))) {
header('HTTP/1.0 403 Forbidden');
exit('This script is only accessible from localhost.');
}
That will enable the config.php to be called from "extern". Don't forget to remove the comments after you've checked everything.
If you have console access on the production server, enter the root directory of your project and call php app/check.php to run the checks on the console.
I have this problem for days now... I just do a fresh install on syfmony but after i create a bundle from symfony console i get this error from the webpage...
ContextErrorException: Warning: is_dir(): open_basedir restriction in effect.
File(/srv/www/backend.tacon.eu/web) is not within the allowed path(s): (/var/www/clients/client1/web5/web:/var/www/clients/client1/web5/private:/var/www/clients/client1/web5/tmp:/var/www/backend.tacon.eu/web:/srv/www/backend.tacon.eu/web:/usr/share/php5:/usr/share/php:/tmp:/usr/share/phpmyadmin:/etc/phpmyadmin:/var/lib/phpmyadmin) in /var/www/clients/client1/web5/web/back/vendor/symfony/symfony/src/Symfony/Component/Process/ExecutableFinder.php line 59
I don't know why is this happening. This is not my first symfony project and this never happens. Also on the same server i have various symfony projects.
Thanks in advance
I had the same problem after refresh install symfony using composer.
I have solved this issue by editing php configuration file (php.ini).
Set the open_basedir option to null.
More about open_basedir
From ISPConfig:
WebSites-> Your Site -> Options -> PHP open_basedir ->
Add :/srv/www/backend.tacon.eu/web at the end of line
if you face this error on live server then you can solve this problem like this-
<?php
require_once __DIR__.'/../app/bootstrap.php.cache';
require_once __DIR__.'/../app/AppKernel.php';
use Symfony\Component\HttpFoundation\Request;
$kernel = new AppKernel('prod', true);
$kernel->loadClassCache();
// wrap the default AppKernel with the AppCache one
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);
in line $kernel = new AppKernel('prod', true); you may change it "prod" or "dev" and it's value like true or false;
I have problem with my Symfony2 project. I created new bundle using console, but default controller is avalible only from dev environment level.
For
http://localhost/myproject/web/app_dev.php/hello/ZaqU
everything works fine, but for
http://localhost/myproject/web/app.php/hello/ZaqU
i'm redirecting on
http://localhost/myproject/web/hello/ZaqU
and then i getting only page 404.
This is new bundle and i didn't changed default files so I don't understand why it doesn't work. Files:
/* #FILE: app/AppKernel.php */
$bundles = array(
//...
new ZaqU\TestBundle\ZaqUTestBundle(),
);
.
/* #FILE: app/config/routing.yml */
ZaqU_test:
resource: "#ZaqUTestBundle/Resources/config/routing.yml"
prefix: /
Have you tried to clear your prod cache? Run the following command in the console:
./app/console cache:clear --env=prod
You might have not enabled the production environment in web/app.php. Change the false into true.
$kernel = new AppKernel('prod', true);
Hope this helps.
Cheers!