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.
Related
I'm currently using webstorm to program my webpage and when I open it through Google chrome and host it locally, the url the browser uses is
http://localhost:63342/assignment2/statichtmlpage-edit.html?_ijt=nqejipcmjnaun1b1416leu6a2i
When I open Terminal in order to host it on ngrok, I type in ./ngrok http 63342
and then a window opens with the ngrok url that I can use
but when I go to that URL (http://4038e733.ngrok.io) all I get is a 404 NOT FOUND error.
I'm not sure why this is happening, any help would be appreciated
Access your page with the full URL:
http://4038e733.ngrok.io/assignment2/statichtmlpage-edit.html?_ijt=nqejipcmjnaun1b1416leu6a2i
Add your path to web (.html) files after the http://4038e733.ngrok.io/ page.
You were hosting from the root directory http://localhost:63342/, but forgot to point to a file. So as expected, the error:
GET / 404 Not Found
Is saying there is no file at the root directory.
I'd imagine the fix for most users is to append /index.html to the end of their ngrok link:
http://ngrok.io/ ... /index.html
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
After I finished my project of symfony2 on windows I wanted to deploy it on a digitalocean server with Linux-Ubuntu OS. But there are some problems I can't figure them out. Please help me soon.
I uploaded the web folder files to folder html on server and other files (src , app , bin, vendor) to www folder. I also followed the instructions on config.php and solved the problems. But yet:
1- When I trying to type url : ip_address/app.php/ on browser a white page comes. No page and No error!
2- When I want to clear the cache in production env using the putty this error happens. ( Unable to write in the "C:/wamp/www/my-project/app/cache/prod" directory) but there is no such problem when clearing on localhost (I think this problem is because of transferring the project from windows to linux)
Please help me.
You probably have some errors (maybe cache directory).
For testing open the file web/app_dev.php and comment this:
/*if (isset($_SERVER['HTTP_CLIENT_IP'])
|| isset($_SERVER['HTTP_X_FORWARDED_FOR'])
|| !in_array(#$_SERVER['REMOTE_ADDR'], array('127.0.0.1', 'fe80::1', '::1'))
) {
header('HTTP/1.0 403 Forbidden');
exit('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.');
}
*/
Now you can access your page via ip_address/app_dev.php/ and see errors. When you finish, don't forget to uncomment this.
If you have problems with cache, then I suggest you to upload code without cache directory. Then create this directory in the server and give it right permissions.
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
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.