Symfony2.5 "cannot load resource after deploying on shared hosted server " - symfony

My code is working fine in localhost but when i deployed it on a "Shared Hosted Server"
then its giving following error:
Cannot load resource "#AcmeTestBundle/controller". Make sure the "AcmeTestBundle" bundle is correctly registered and loaded in the application kernel class.
on server i'm able to access config.php but when i tried to access app_dev.php or app.php
it shows the above error message
my routing is defined in "app/config/routing.yml" as
test:
resource: "#AcmeTestBundle/controller"
type: annotation
prefix: /
I cleared the cache also but nothing changed.
Am i missing something ???
Please Help me
Thanks in advance

Related

Open files in PHPStorm with Vagrant+Symfony application

I know you can open files from Symfony profiler or exception file links using this in project/app/config.yml :
framework:
ide: "phpstorm://open?file=%%f&line=%%l"
More info: http://developer.happyr.com/open-files-in-phpstorm-from-you-symfony-application
However as I'm using vagrant, the file path of the server doesn't match my host.
I have created a PHP web application server in PHPStorm with the propper path mappings, but still doesn't work.
Any ideas?
Thanks
When running your app in a container or in a virtual machine, you can tell Symfony to map files from the guest to the host by changing their prefix. This map should be specified at the end of the URL template, using & and > as guest-to-host separators:
// /path/to/guest/.../file will be opened
// as /path/to/host/.../file on the host
// as /path/to/host/.../file on the host
'phpstorm://%f:%l&/path/to/guest/>/path/to/host/&/foo/>/bar/&...'
Symfony FrameworkBundle Configuration - IDE
The answer given by Jeffry no longer works unfortunately :(. When In configure that with my paths the profiler throws:
ParameterNotFoundException
You have requested a non-existent parameter "f:".
I have configured the path according to this line in the SF docs: This map should be specified at the end of the URL template, which results in this:
phpstorm://open?url=file://%%f&line=%%l&/path/to/guest/>/path/to/host/
However, it does open PHPStorm, but phpstorm does not open the file, so i'm a bit stuck here now.
This solves the issue with the file not opening in PhpStorm from a Vagrant:
phpstorm://open?file=%%f&line=%%l&/path/to/guest/>/path/to/host/
Source: https://youtrack.jetbrains.com/issue/IDEA-65879

Relative directory loading in routing.yml without bundle reference

I'm trying to use Symfony2 without bundles. When my routing.yml looks like this:
app:
resource: "/var/www/oo_talks/src/UI"
type: annotation
Everything works in browser. But how do I get rid of full path here if I do not use bundles? How can I reference root project folder?
And still, running console command gives error about being unable to load a resource.
Added later, based on comments:
resource: "%kernel.root_dir%/src/UI" doesn't work as well as resource: "%kernel.root_dir%/../src/UI". Still "Cannot load resource" error.
Adding parameter with full path and referencing it doesn't work either.
By default relative path is resolved by file_locator service relatively to the %kernel.root_dir%/Resources directory or relatively to the directory of the file where path was specified.

How to run a command when a Symfony2 project is online (production mode)

How can you run a command on a Symfony2 command when it is online? I see that you need a command window but my project is going to be ran at a server that isn't mine, so how can I run commands on it? My host provides directadmin.
You can use https://github.com/CoreSphere/ConsoleBundle
If you have the "no route" error, try to access to
yoursite/web/app_dev.php/_console/_console
as the prefix defined in your routing_dev.yml will be added to the path defined in the Bundle's routing.yml
routing_dev.yml
_console:
resource: "#CoreSphereConsoleBundle/Resources/config/routing.yml"
prefix: /_console
#routing.yml from ConsoleBundle
console:
path: /_console

Symfony2.5.0 fresh install - No route found for "GET /", 404 Not Found - NotFoundHttpException

Hi I am new to symforny2
I have just installed symfony2 on my easyphp server. When I open web directory symfony try to open app.php. For some reason I got this output:
No route found for "GET /"
404 Not Found - NotFoundHttpException
1 linked Exception: ResourceNotFoundException ยป
[2/2] NotFoundHttpException: No route found for "GET /" +
[1/2] ResourceNotFoundException: +
Logs -
Stack Trace (Plain Text) +
When I open app_dev.php, everything looks normal.
Why do I get this 404 error on app.php ? Is that normal or is this a bug in symfony2.5.0
(demos in app_dev.php are working well)
Thank You for your support.
Regards
See one of my previous answer: symfony2 - how to switch from "dev" to "prod"?
Symfony wraps multiple environment. When you access the app.php front controller, you're on the prod environment whereas when you access app_dev.php, you're on the dev environment.
Knowing that, the demo bundle shipped with the standard edition is only enable on the dev environment according to the AppKernel. So, it is normal you can access the demo page on the dev front controller and get a 404 on the prod front controller.

Symfony2 on nginx shared hosting

i've a symfony 2.3.16 project which work great on localhost.
But today i wanted to host it on my remote server : its a shared hosting on nginx 1.4.7
i've changed the public folder (from /web to /public_html : still working great on localhost)
i've cleared then deleted the dev and prod cache,
added my remote IP to app_dev.php and activate the debuger in app.php
and then uploaded all files to my shared hosting.
the tree is like this :
app
bin
public_html
- bundles
- app.php
- app_dev.php
- config.php
- .htaccess
src
vendor
and when i try to access some pages, i've always ended with a 404 Not Found error.
here, you can see : http://dojonantais.cwebh.org/app.php/admin/
i have no route defined for /
my app/config/routing.yml is like this :
dnAdmin:
resource: "#dnAdminBundle/Resources/config/routing.yml"
prefix: /admin
also, when i try dev environnement http://dojonantais.cwebh.org/app_dev.php
it says there is no route for /, which is logic, but i've another error with the debug bar :
An error occurred while loading the web debug toolbar (404: Not Found).
Do you want to open the profiler?
and when i open the profiler : 404 not found
again, i can access the config.php and it says my server is ok to run Symfony, but cant access the configurator (404 error)
So, what is missing?
Thanks again.
So, problems coming from my remote host on nginx.
i change the host to a 1and1 server and all is ok.

Resources