Symfony2 Twig_Error_Loader - Twig doesn't find templates - php

I look for a while, but don't find a solution. I have a Symfony2 project that I'm trying to deploy. The strcture that I have is this:
/www/my_app/ -> where lives all symfony folders (app, bin, src and vendor) but 'web'
/www/public_html/my_app/ -> this is the 'web' folder renamed to 'my_app'
With this structure I change the routes in app.php:
$loader = require_once __DIR__.'/../../my_app/app/bootstrap.php.cache';
require_once __DIR__.'/../../my_app/app/AppKernel.php';
And I get this error:
Fatal error: Uncaught exception 'Twig_Error_Loader' with message 'The "D:\www\public_html\my_app\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle/Resources/views" directory does not exist.' in D:\www\my_app\vendor\twig\twig\lib\Twig\Loader\Filesystem.php on line 93
Twig_Error_Loader: The "D:\www\public_html\my_app\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle/Resources/views" directory does not exist. in D:\www\my_app\vendor\twig\twig\lib\Twig\Loader\Filesystem.php on line 93
The problems is that that files that Twig are trying to load no lives in "D:\www\public_html\my_app\vendor", but in "D:\www\my_app\vendor".
I hope that you can get the problem. I'm running the app within apache.
Thanks in advance for any comment.

I'm not sure if it would help in your case, but when I want to load twig templates from other directories in controller I run:
$this->get('twig.loader')->addPath('../app');
This is just example how I tell Twig - "I want also use templates from other ../app path".

Related

CakePHP core could not be found

Website given error like as bellow. its build using cakephp. Can you help me
Fatal error: CakePHP core could not be found. Check the value of CAKE_CORE_INCLUDE_PATH in APP/webroot/index.php. It should point to the directory containing your /cake core directory and your /vendors root directory. in /home/tracepk/public_html/webroot/index.php on line 0
View this solution and provide for analyze content of your file index.php

Trying to deploy Laravel 4 website on godaddy shared hosting results into exception

I am trying to deploy my laravel4 website in shared hosting where.
I have a website http://healthscapeseries.com so now when I write http://healthscapeseries.com/myappname/public/ I want my app to open . I uploaded myappname inside the folder that corresponds to my websites index page .
I am getting following error:
Symfony \ Component \ HttpKernel \ Exception \ NotFoundHttpException
11. Symfony\Component\HttpKernel\Exception\NotFoundHttpException
…\vendor\laravel\framework\src\Illuminate\Routing\RouteCollection.php148
10. Illuminate\Routing\RouteCollection match
…\vendor\laravel\framework\src\Illuminate\Routing\Router.php1054
9. Illuminate\Routing\Router findRoute
…\vendor\laravel\framework\src\Illuminate\Routing\Router.php1022
8. Illuminate\Routing\Router dispatchToRoute
…\vendor\laravel\framework\src\Illuminate\Routing\Router.php1001
7. Illuminate\Routing\Router dispatch
…\vendor\laravel\framework\src\Illuminate\Foundation\Application.php775
6. Illuminate\Foundation\Application dispatch
…\vendor\laravel\framework\src\Illuminate\Foundation\Application.php745
5. Illuminate\Foundation\Application handle
…\vendor\laravel\framework\src\Illuminate\Session\Middleware.php72
4. Illuminate\Session\Middleware handle
…\vendor\laravel\framework\src\Illuminate\Cookie\Queue.php47
3. Illuminate\Cookie\Queue handle
…\vendor\laravel\framework\src\Illuminate\Cookie\Guard.php51
2. Illuminate\Cookie\Guard handle
…\vendor\stack\builder\src\Stack\StackedHttpKernel.php23
1. Stack\StackedHttpKernel handle
…\vendor\laravel\framework\src\Illuminate\Foundation\Application.php641
0. Illuminate\Foundation\Application run
…\public\index.php97
Have you found any solution yet? If not then this might be one of the solution. What needs to be done is as follqws:
Copy all the files and folders including the public folder of your app to the "public html" folder of the shared hosting.
Copy all the contents of the laravel public folder to the "public html" folder.
Now just remove the Laravel's public folder.
Now Open up laravel's bootstrap/paths.php file and then change the change the path
'public' => DIR.'/../public',
to
'public' => __DIR__.'/..',
Now open up the index.php file which was actually in your laravel's public folder but now in the "public html" folder and change
require DIR.'/../bootstrap/autoload.php';
$app = require_once DIR.'/../bootstrap/start.php';
to
require __DIR__.'/bootstrap/autoload.php';
$app = require_once __DIR__.'/bootstrap/start.php';
Now you are good to go. Let me know the update. Good luck.

Got Fatal error CodeIgniter CI_Controller not found

I got following error on every controller
Fatal error: Class 'CI_Controller' not found in /<path>/system/core/CodeIgniter.php on line 233
The root folder has also its same separate codeigniter system (all ci structure) folder. the site in root in working but when i copy the another ci structure in sub folder i got mentioned fatal error. please help me.
Check your database config in application/config/database.php it's one of the major time consuming error message I faced with CI. Because the error message was simply misleading. So, check the DB config first.
I had a similar problem when trying to run a migration that is within a folder, it appears that my 'git' is with a conflict in the directory separator.
I was trying to run on command line:
$ php index.php tools/migration
fix it temporarily with the command:
$ php index.php tools migration

Error: application file does not exist

I have installed a new zf project, and get the next error:
Warning: require_once(Zend/Application.php) [function.require-once]: failed to open stream: No such file or directory in C:\wamp\www\zend\public\index.php on line 18
I have set the include path and in addition i have uploaded zf to the library folder.
But, I can't find any trace to a file named Application.php ...
Somewhere along the line you have mixed ZF1 and ZF2 instructions or code. There is no Zend/Application.php in ZF2 (this is a ZF1 thing), and ZF2 apps do not generally have a 'library' folder. So either you are using ZF2 but have followed some app setup instructions for ZF1, or you've used the ZF1 command line tool to create a ZF1 project and have then put ZF2 into the library folder.
Here is the ZF2 skeleton app: https://github.com/zendframework/ZendSkeletonApplication - this should give you an idea what your app should look like.
As the error obviously says Zend/Application.php is not there. Check you include path and your folder.

Integrating Codeigniter 2 with phpspec2

I want to integrate phpspec2 with CodeIgniter 2. I've succesfully installed phpspec using composer as described on phpspec website. Now I'd like to integrate it into my CodeIgniter 2 installation. I've found an article by AniDear on this subject and did everything as described. However when I run bin/phpspec I get an error:
PHP Warning: require(core/Common.php): failed to open stream: No such file or directory
in C:\xampp\htdocs\eljotengine\spec\ci_bootstrap.php on line 37
Warning: require(core/Common.php): failed to open stream: No such file or directory in C:\xampp\htdocs\eljotengine\spec\ci_bootstrap.php on line 37
and so on. My file structure looks like this:
eljotengine
|-application
|-sytem
|- ... other CI
|-spec
| |- ci_bootstrap.php
I am using xampp on Windows 7. My ci_bootstrap.php file looks like the one in the above mentioned article by AniDear.
I've tried to change the paths in the ci_bootstrap.php file (it seems to be the problem) however it did not change much.
Any ideas how to make this work?
Greets :)
I am having problem with PHPSpec2 too.
Since I have only tried it with PHPSpec (not PHPSpec2), I would suggest you to install PHPSpec instead. Just change the file composer.json, on the line "phpspec/phpspec2": "*" to "phpspec/phpspec": "*" , then runs composer update again.
Run this phpspec, by using command vendor\bin\phpspec.php.bat spec on your project path, whereas "spec" is the folder containing spec files.
And since you're running phpspec from your project directory, I suggest changing content inside ci_bootstrap.php as follow
define('BASEPATH',realpath('system/').'/'); //set absolute path to CI system/
define('APPPATH', 'application/'); //set relative path to CI application
set_include_path(
get_include_path().PATH_SEPARATOR.
realpath(APPPATH).PATH_SEPARATOR.
realpath(BASEPATH).PATH_SEPARATOR.
'spec'); //adding 'spec' in path, for easily do require 'ci_bootstrap.php' from inside spec files
require BASEPATH.'core/Common.php';
require APPPATH.'config/constants.php';
require BASEPATH.'core/Controller.php';

Categories