Oops! An Error Occurred The server returned a "500 Internal Server Error" on new actions created - symfony-1.4

I get the error as soon as I enter one of my actions on the project.
Oops! An Error Occurred The server returned a "500 Internal Server Error". Something is broken
Only on 1 page (Action) it happens. The most recent Action I created. The strange thing is that this happens only on the server. Locally on my windows server the page works normally.
The PHP internal logs on the server returns no errors.
The error occurs even if I remove all the code in the action and even if I clear the cache with 'php symfony cc'. Even if I set the permissions with 'php symfony project:permissions'. Even if I combine all of the previous solutions in different order.
Here is the action code:
public function executeExportPostsToProject(sfWebRequest $request)
{
echo 'why?? Show me please!';
}
On the same module there are about 20 other actions decleared the same way. I'm going crazy.
Tryed to check my server configuration for symfony. No Warnings.
The symfony version is 1.4.5.

Seems that the file name of the View is case sensitive under Linux. On Windows hadn't the same problem. On Linux for some reasons with the new files created on windows the problem occured. I renamed the View from exportPostsToProject.php to ExportPostsToProject.php solved this problem.

add route like this in your routing.yml for this action:
route_name:
url: /route-name-example
param: { module: ModuleName, action: exportPostsToProject }
and make sure to be on DEV environment

Related

Meteor - Accounts.forgotPassword triggers internal server error whil Email.send is working fine

I'm meeting an issue on Meteor with Accounts.forgotPassword method.
My email smtp is well set up as I can use Email.send() without any issue once app is deployed.
But strangely, accounts.forgotPassword return an internal error.
When looking at the logs I have this error :
Exception while invoking method 'forgotPassword' Error: Mail command failed: 550-Requested action not taken: mailbox unavailable
I do not really understand why I would have mailbox unavailable error with Accounts.forgotPassword but not with Email.send()
Does anyone already met that kind of issues ?
I have already searched on the web for any clues but did not find anything :(
FYI I use ionos smtp
Since Email.send is working, I assume your MAIL_URL is set correctly, but your Accounts.emailTemplates is not. From https://docs.meteor.com/api/passwords.html:
In addition to configuring the email package’s MAIL_URL, it is critical that you set proper values (specifically the from address) in Accounts.emailTemplates to ensure proper delivery of e-mails!

Symfony routes not working anymore

I have an application been working on for a while with a fully working login and creating new users functionalities, and out of no where i was trying to switch the user -to change the role- i wasnt able to login again. after some digging around the code i found out that 302 code status is being thrown after login and therefor the logging process stopped working.
i had this code in my SecurityController:
return new RedirectResponse('/sys-admin/');
and changing that code to this :
return $this->forward('AppBundle:SystemAdmin:index', array());
make it work and i am logged in again but now all my routes stopped working, i mean in my views there are buttons something like :
<a href="{{ path('system_admin_client') }}"
class="btn pmd-btn-flat btn-default">Go!</a>
when i click the button i am logged out and redirected to the login page and in the network tab in any browser i can see that the route sys-admin/client have status code 302 since i was logged out.
running bin/console debug:router shows me all my routes are there and for this example running bin/console router:match /sys-admin/client also shows me a match with the controller and every information.
this is how my routes looks like:
app_system_admin:
prefix: /sys-admin
resource: "#AppBundle/Resources/config/routing/sys_admin.yml"
sys_admin.yml
system_admin_client:
path: /client
defaults: { _controller: AppBundle:SystemAdmin:index}
I cant figure out to know what went wrong! any help will be appreciated. Thanks!
more info: i am using Symfony 4.0.4 and if i tried to do something like forwarding on any route its working but the redirecting is not.
The 302 HTTP status code is for a redirection, it's not an error.
It was normal since you returned a RedirectResponse.
In my opinion the problem doesn't come from the redirection.
You should put it back and check the user-switching function (or the user itself).
If you do that, don't hardcode the redirection path. Use a Symfony method to generate it, like:
return $this->redirectToRoute('system_admin_index');
I found the solution after a lot of investigating. I am using docker to make the whole app running and for some reason php-fpm logs showed no errors but the error was the php session is being broken because of no access for the user, changing to root user on docker fixed this issue since root had access.

'Failed to load resource' after adding new controller

I have already added 2 controllers in my Web API, StudentsController and AuthenticateController, and and everything is working as it should. When I go to http://localhost:64792/api/students, it prints the default: ["value1","value2"]
The problem is when I add a third controller, nothing works anymore. When i go to the same URL, I get the following error:
Failed to load resource: the server responded with a status of 500 (Internal Server Error)
Are you limited to 2 controllers only, or what am I missing here?

Not able to display 404 error in prod environment

When I try to throw a simple throw $this->NotFoundHttpException('We do not currently have a website configured at this address. Please visit our website for more information or contact our support team');in dev environment, it works fine. But when I do the same in prod environment I get 500 server error.
Any ideas?
Here are screenshots of my dev and prod log files
Note: 500 error only happens when I use www in the url in prod env. On using any other word eg. nike, this is what i get
Here is the dev env result for the normal www.blore.eduflats.com url
According to the symfony documentation in order to return a 404 from your controller you need to do the following:
throw $this->createNotFoundException('The product does not exist');
Whereas, you have
throw $this->NotFoundHttpException
The error you are seeing is telling you that NotFoundHttpException does not exist. To fix your problem simply replace NotFoundHttpException with createNotFoundException
You call Eduflas.. UniversityResolver->NotFoundHttpException();
If you want to trhow exception like this, you should declare it.
Symfony Controller have $this->createNotFoundException('Something Not found');
You can throw 404 like this:
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException
//...
throw new NotFoundHttpException("Not found");
Use this way to be sure that Exception exist and test it.
Anyway clear your production and dev cache to be sure you use "the same code".
Last thing that come to my head - its possible you override error pages and you make something to your error.html.twig or error404.html.twig and you got different pages.
EDIT
When i enter your http://blore.eduflats.com/ i got
"array(29) { ["HTTP_HOST"]=> string(18) "blore.eduflats.com" ["HTTP_USER_AGENT"]=> s..."
Anyway your dev env. got error too so how it can work on prod env...
If you throw NotFoundException in dev you should get symfony debugger page and this error. In porduction this error is catch with ExceptionController and display blank error page (user should not see exceptions, only 500 error)

reCaptcha validation with timeout exception

I am using reCaptch in my MVC 3 web app running in the localhost.
Things were working fine few weeks back but suddenly failing.
Suddenly getting this error.
if(!ReCaptcha.Validate(_config.RecaptchaPrivateKey)){ <-- times out here
//process other fields in the form
}
As soon as I fill the form and hot submit I get this error :
The operation has timed out
Description : An unhandled exception occurred during the execution of the current ...
Exception Details : System.Net.WebException: The operation has timed out
Is this a proxy issue?
Is this because my site on localhost runs on port 3316?
localhost:3316/user/signup
I saw some posts that suggests that reCAPTCHA expects port 80 but my app runs on port 3316
What can be the issue?
Thanks
I got around this by creating proxy class that inherits IWebProxy.
Then specifying to use this proxy when internal, I had to transform it out for other environments that didn't need to use it.
See this question and accepted answer:
Is it possible to specify proxy credentials in your web.config?
The above link took some finding, so I favourited it for future use.

Resources