Symfony2: access same route in production as development - symfony

I'm developing a little application using Symfony2. I can access all routes with no problems in my dev environment:
http://symfony/app_dev.php/cp ("symfony" is in my hosts file to resolve to localhost)
However, as soon as I try and access it in the production environment, I just get a 404 error page:
http://symfony/app.php/cp
Oops! An Error Occurred
The server returned a "404 Not Found".
Something is broken. Please e-mail us at [email] and let us know what you were doing when this error occurred. We will fix it as soon as possible. Sorry for any inconvenience caused.
Is there something I need to change/do before I can view my application in production? I've not messed with any of the core files (kernel/bootstrap/app files, etc). I'm using Release Candidate 3.

As Crozin already mentioned in his comment, you have to rebuild cache to be able to see your changes. You need to rebuild production cache every time you change something in config, routing or templates. The safest way to do so is using php app/console cache:clear --env=prod --no-debug (as CLI runs in dev mode with debugging enabled by default).

Related

Xdebug with PhpStorm stops working when assigning an URL for Symfony debug server

I'm developing a Symfony PHP Application which uses Azure Active Directory authentication. I'm using PhpStorm on Windows 10 as my IDE.
Azure Active Directory requires me to register a redirect URL but doesn't allow it to be http://127.0.0.1:8000 so I had to register http://localhost:8000
For that reason, in PhpStorm, I had to change my Run/Debug Configuration in order to change bin\console arguments from server:run to server:run localhost:8000.
But since I did that, PhpStorm no longer stops at my assigned breakpoints, as if it weren't listening to Xdebug's connections, although it is set to do so. I'm sure the problem is the new URL, because when I rolled back my change, it came back to normal.
I know the question is rather specific.

Invalid CSRF token on sulu CMF (production)

I've managed setting up a development environment running Symfony and sulu cmf. For production I have done the same, but then both Symfony and sulu with production-environment setting.
Everything is running fine except one small issue. When I want to log in, Chrome console shows me 'Invalid CSRF token'
I have cleared the cache of both browser and server, but it does not make any difference.
Any suggestions/experience with this issue?

403 Forbidden with Log4Net and MVC5

So I followed this tutorial to add logging to my project. Locally everything works fine, but when I deploy it to my staging environment and try to even visit the root page of the site I get a 403.14 Forbidden error saying that I need to enable Directory Browsing. I read somewhere that log4net uses a different user account to log and that could be causing issues. I was also thinking that it could be due to the location I am logging. I was hoping someone else had experienced this and could point out a solution.
The problem isn't with your code or Log4Net, it's with your hosting environment's default settings. Change the directory of the log file that is being written to a directory where you actually have rights, or change the access on the directory to which you are writing... Sounds like you're on a shared hosting server, and you usually need to manually enable whether or not a directory can have write access (ie: GoDaddy, etc). I've had this a few times and it was simple as that. This is why it was working locally (you have permissions to your own machine) and not once it was deployed.

Symfony on sharing host, No input file specified.

I'm trying to upload my symfony2 project on godaddy, on a sharing host.
I have several problems like a message : No input file specified when i login, register or other action.
Do you know something about this error message ?
I'm pretty sure that's related with the PHP version is running on godaddy server. But it should be related also with another tools they use for compilation process.

drupal internal server error

I had created a folder in my site, and uploaded drupal in it. But when I access it, the following error is coming
Internal Server Error
The server encountered an internal error or misconfiguration and was unable
to complete your request.
Please contact the server administrator, webmaster#xxxxxx.xx and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
There are literally thousands of things that can be wrong
Do you have access to the webserver logs? Check /log/apache/error.log for errors.
Have you already configured drupal correctly? Normally, when you surf to the drupal root directory, you get presented with an installer message.
Does your server support PHP?
I'd recommend any of the following:
Checking that you meet the Drupal requirements
Re-uploading the whole Drupal folder
Testing the Drupal folder (is this a custom installation, or just straight from the drupal website?) on local LAMPP webserver.
Assuming you're trying to run Drupal for the first time (ie run the installer), have you followed the pre-install setup?
Here's Drupal's "Quick install guide for beginners": http://drupal.org/documentation/install/beginners
Since you've already uploaded the code and you have your domain set up, you can probably skip down to the big labelled "Create the configuration file and grant permissions".
The first thing in this section is to create your settings.php file. Drupal won't work without this. You also need to set its file permissions to that Drupal's installer can update it.
My guess is that this is why you're getting the error. Follow the instructions on the page I linked you to above and you should be okay.
You'll also need to have a database ready for use by Drupal. The Drupal installer will populate the DB tables, but you need to at least have the empty DB ready for it to use.
Hope that helps.

Resources