Chapters
This course is archived!
Ask Questions!
Scroll down to the script below, click on any sentence (including terminal blocks) to jump to that spot in the video!
Ask Questions!¶
Hi guys! It’s time for KnpU Question and Answer day: your chance to submit your burning programming questions and our chance to listen for a change! Here’s how it works:
1) Ask your questions about PHP, Symfony, Behat, dinosaurs, or anything else as as a comment on this page before the closing time and we’ll pretend to know the answers.
Note
You have until the end of Tuesday, March 26th, 2013 to post questions!
(Psssst - the comments are over on the right side ===================>)
- The next day, we’ll open this page up and start answering them! Follow us on Twitter and if you include your Twitter handle with your question, we’ll give you a shout-out.
Note
Answer day is Wednesday, March 27th, 2013. Follow us on twitter @KnpUniversity
That’s it! We really want to hear what questions you’re having in your real projects. We can’t guarantee we’ll be able to answer every question, but we’ll give it the old college try ;).
And remember any question or code gists you post are public. So, it may be a good idea to not tell the world what your database password is :)
See ya then!
6 Comments
Hey Dan!
That *is* very odd. Make sure you're running this from the root of your project. The command is very simply looking for a "web" directory. And for one reason or another, it's not finding it. Make sure that directory exists (it will, unless you've deleted or moved it) and that you're running the command from the root of your project (it looks like you are, but just double-check).
Cheers!
Hello! Indeed, that was the problem, you have to mind where you are when running the command. Thanks.
Hi
I was wondering if you could talk about this:
I have multiple database connections which I know how to do but I can't figure out the symfony way to do environment aware db connections.
For example I have Dev, Qa, Release, Production as part of my environment variable in the vhost
I have several different databases and their connection.
Normally I would do this in a switch
ie.
switch($env)
case('Dev')
'db1' => array('conn'=>'###','port'=>'###',...etc.)
'db2' => array('conn'=>'###','port'=>'###',...etc.)
'db3' => array('conn'=>'###','port'=>'###',...etc.)
break;
case('Qa')
'db1' => array('conn'=>'###','port'=>'###',...etc.)
'db2' => array('conn'=>'###','port'=>'###',...etc.)
'db3' => array('conn'=>'###','port'=>'###',...etc.)
break;
...etc
I want to know if you could help me do this using the entity manager
http://symfony.com/doc/curr...
or is there a more preferred way?
Thanks in advance
Hi Nathanael!
I can at least give you some ideas. It sounds like you're already successfully setting some environmental parameters in your virtual host. But just in case, here's information on that: http://symfony.com/doc/curr...
I think you have 2 options:
A) Set environment variables for all parts of your connection in the virtualhost - .e.g SYMFONY__DB1_USER, SYMFONY__DB1_PASS, SYMFONY_DB2_USER, etc etc. These will all map to parameters (e.g. db1_user, db2_pass, etc) and you can use these in config.yml very easily. I recommend this.
B) Set an environment variable called, like DB_ENV. Then, from `config.yml` include `config.php`. This is a configuration file (it serves the same purpose as config.yml), but it's written in PHP. This means you read this value with PHP's getenv function, then use a switch statement like above to set different parameters like `db1_user`, `db2_user`, etc. You'd use these values in `config.yml` just like in option (A). We talk about this approach a little bit here: http://symfony.com/doc/curr...
Hopefully one of these helps you out :).
Cheers!
"OrangeHRM Symfony(1.4) site moved from local to liver server causing a page crash"
HI
I moved a site from local to live server. it is working just fine on local server but causing a page crash on live server.
I have cleared the cache. Everything is just fine on local server and also on live server except a single page crash on live server with the error
"An internal error occurred. Please contact your system administrator."
when I check the logfile orangehrm.log
inside symfony/log
the following message appears
Thu 14 May 2015 12:29:13 PM GST,102 [1376] ERROR filter.ExceptionCatcherFilter - Uncaught Exception: exception 'sfRenderException' with message 'The template "ViewRequestSuccess.php" does not exist or is unreadable in "HERE SHOULD BE DIRECTORY NAME BUT IT IS EMPTY(THIS IS ADDED TO MENTION THE ERROR POINT)".' in /var/zpanel/hostdata/some_app_name/public_html/hrm_something_com/symfony/cache/orangehrm/prod/config/config_core_compile.yml.php:2029
Stack trace:
#0 /var/zpanel/hostdata/some_app_name/public_html/hrm_something_com/symfony/cache/orangehrm/prod/config/config_core_compile.yml.php(3908): sfView->preRenderCheck()
#1 /var/zpanel/hostdata/some_app_name/public_html/hrm_something_com/symfony/cache/orangehrm/prod/config/config_core_compile.yml.php(979): sfPHPView->render()
#2 /var/zpanel/hostdata/some_app_name/public_html/hrm_something_com/symfony/cache/orangehrm/prod/config/config_core_compile.yml.php(966): sfExecutionFilter->executeView('performance', 'ViewRequest', 'Success', Array)
#3 /var/zpanel/hostdata/some_app_name/public_html/hrm_something_com/symfony/cache/orangehrm/prod/config/config_core_compile.yml.php(934): sfExecutionFilter->handleView(Object(sfFilterChain), Object(performanceActions), 'Success')
#4 /var/zpanel/hostdata/some_app_name/public_html/hrm_something_com/symfony/cache/orangehrm/prod/config/config_core_compile.yml.php(1031): sfExecutionFilter->execute(Object(sfFilterChain))
#5 /var/zpanel/hostdata/some_app_name/public_html/hrm_something_com/symfony/lib/vendor/symfony/lib/filter/sfCommonFilter.class.php(29): sfFilterChain->execute()
#6 /var/zpanel/hostdata/some_app_name/public_html/hrm_something_com/symfony/cache/orangehrm/prod/config/config_core_compile.yml.php(1031): sfCommonFilter->execute(Object(sfFilterChain))
#7 /var/zpanel/hostdata/some_app_name/public_html/hrm_something_com/symfony/plugins/orangehrmCorePlugin/lib/filter/orangehrmPostExecutionFilter.php(22): sfFilterChain->execute()
#8 /var/zpanel/hostdata/some_app_name/public_html/hrm_something_com/symfony/cache/orangehrm/prod/config/config_core_compile.yml.php(1031): orangehrmPostExecutionFilter->execute(Object(sfFilterChain))
#9 /var/zpanel/hostdata/some_app_name/public_html/hrm_something_com/symfony/apps/orangehrm/lib/filter/ModuleFilter.php(56): sfFilterChain->execute()
#10 /var/zpanel/hostdata/some_app_name/public_html/hrm_something_com/symfony/cache/orangehrm/prod/config/config_core_compile.yml.php(1031): ModuleFilter->execute(Object(sfFilterChain))
#11 /var/zpanel/hostdata/some_app_name/public_html/hrm_something_com/symfony/plugins/orangehrmCorePlugin/lib/authorization/filter/ohrmAuthorizationFilter.php(97): sfFilterChain->execute()
#12 /var/zpanel/hostdata/some_app_name/public_html/hrm_something_com/symfony/cache/orangehrm/prod/config/config_core_compile.yml.php(1031): ohrmAuthorizationFilter->execute(Object(sfFilterChain))
#13 /var/zpanel/hostdata/some_app_name/public_html/hrm_something_com/symfony/apps/orangehrm/lib/filter/SessionInfoFetcherFilter.php(67): sfFilterChain->execute()
#14 /var/zpanel/hostdata/some_app_name/public_html/hrm_something_com/symfony/cache/orangehrm/prod/config/config_core_compile.yml.php(1031): SessionInfoFetcherFilter->execute(Object(sfFilterChain))
#15 /var/zpanel/hostdata/some_app_name/public_html/hrm_something_com/symfony/apps/orangehrm/lib/filter/OrangeI18NFilter.php(58): sfFilterChain->execute()
#16 /var/zpanel/hostdata/some_app_name/public_html/hrm_something_com/symfony/cache/orangehrm/prod/config/config_core_compile.yml.php(1031): OrangeI18NFilter->execute(Object(sfFilterChain))
#17 /var/zpanel/hostdata/some_app_name/public_html/hrm_something_com/symfony/apps/orangehrm/lib/filter/ExceptionCatcherFilter.php(26): sfFilterChain->execute()
#18 /var/zpanel/hostdata/some_app_name/public_html/hrm_something_com/symfony/cache/orangehrm/prod/config/config_core_compile.yml.php(1031): ExceptionCatcherFilter->execute(Object(sfFilterChain))
#19 /var/zpanel/hostdata/some_app_name/public_html/hrm_something_com/symfony/lib/vendor/symfony/lib/filter/sfBasicSecurityFilter.class.php(72): sfFilterChain->execute()
#20 /var/zpanel/hostdata/some_app_name/public_html/hrm_something_com/symfony/cache/orangehrm/prod/config/config_core_compile.yml.php(1031): sfBasicSecurityFilter->execute(Object(sfFilterChain))
#21 /var/zpanel/hostdata/some_app_name/public_html/hrm_something_com/symfony/cache/orangehrm/prod/config/config_core_compile.yml.php(995): sfFilterChain->execute()
#22 /var/zpanel/hostdata/some_app_name/public_html/hrm_something_com/symfony/cache/orangehrm/prod/config/config_core_compile.yml.php(1031): sfRenderingFilter->execute(Object(sfFilterChain))
#23 /var/zpanel/hostdata/some_app_name/public_html/hrm_something_com/symfony/cache/orangehrm/prod/config/config_core_compile.yml.php(665): sfFilterChain->execute()
#24 /var/zpanel/hostdata/some_app_name/public_html/hrm_something_com/symfony/cache/orangehrm/prod/config/config_core_compile.yml.php(2352): sfController->forward('performance', 'ViewRequest')
#25 /var/zpanel/hostdata/some_app_name/public_html/hrm_something_com/symfony/lib/vendor/symfony/lib/util/sfContext.class.php(170): sfFrontWebController->dispatch()
#26 /var/zpanel/hostdata/some_app_name/public_html/hrm_something_com/symfony/web/index.php(22): sfContext->dispatch()
#27 {main}
I have added this line in above error message to mention the error point here.
HERE SHOULD BE DIRECTORY NAME BUT IT IS EMPTY(THIS IS ADDED TO MENTION THE ERROR POINT)
after spending lot of time on debugging, I found out that on live server, it is not showing directory name i.e directory variable is empty. can anyone help that where should I change the setting/config or what can be the possible reason for this.
"Houston: no signs of life"
Start the conversation!
Hi, I am stuck on this error after running: php app/console assets:install --symlink
[InvalidArgumentException]
The target directory "web" does not exist.