Recently I have tried to write a code in Symfony on page redirect (merely simple code for redirect without any other function), run it on localhost. However, the response returned is quite slow somehow (~500ms). What would be the possible cause of this as Laravel page redirect is faster than this.
When you open the Symfony profiler (just click on the debug toolbar that gets displayed in the bottom of the pages if you are in a development environment) there is a "Last 10" requests button you can click to view profiler information for last couple of requests.
Find your request that returned the redirect response, click on the Token value and you will be able to see in the "Performance" page what is causing the slowdown.
Also, when in development mode some of the changes that you make will require the container to be rebuilt and this can take a while in the development environment with xdebug enabled.
Related
When i´m doing a request to a "huge" page with a lot of data to load, and make a second request to a "normal" content page, the normal page is blocked until the "huge" is loaded.
I activated the Profiler and recognized that the FirewallListener was the blocking element).
Profiler Screenshots (Loaded huge, switched tab - loaded normal)
Huge
Normal
While the "huge" page was loaded, i did a mysql php request on cli with some time measurements:
Connection took 9.9890232086182 ms
Query took 3.3938884735107 ms
So that is not blocking.
Any ideas on how to solve that?
Setup:
php-fpm7.2
nginx
symfony3.4
It is been blocked by the PHP Session.
You can't serve to pages that requires access to the same session id.
Although once you close/serve/release the session on the slow page, another page can be served on the same session. On the slow page just call Session::save() as soon as possible on your controller. This will release the session. Take into consideration that everything you do after saving the session will not be stored in the session.
The reason the firewall takes so long is that of debug is enabled.
In debug, the listeners are all wrapped with debugging listeners. All the information in the Firewall is being profiled and logged.
Try to run the same request with Symfony debug disabled.
We had a similar problem. When sending a couple of consecutive requests to the server in a short period, the server became very slow. I enabled the profiler bar, and a lot of time was spent by the ContextListener
The problem was that file server access on our server is very slow, and session information was stored on the file system, as is the default for symfony.
I configured my app to use the PdoSessionHandler, and the problem was gone.
I'm working on a WP installation set up on an AWS instance. Whenever I try to install a plugin or change ANY setting, I press the button to apply the changes, and the page simply loads forever without redirecting. If I refresh after awhile, I can see that the action was applied as expected.
Same thing applies to submitting new posts - Chrome will take me to an error page saying the "page isn't working", but if I refresh, the post submitted just fine. Literally anything that requires submitting a form, this issue applies to.
How can I begin to debug this? I have no idea what's going on. I've set up Wordpress countless times but never on AWS.
I am using easyphp with xedug installed with Eclipse Luna as my IDE.
I have setup the Debug configuration (Default PHP server setup to point to my localhost), and I am able to launch the debug and hit the localhost server I want to hit.
I can debug through the first part up to the login screen (CodeIgniter loading my config), but once I login none of my later breakpoints are being hit.
I went through each of the 'Similar Questions' listed, but I can't find the answer.
I finally figured this out. I am not sure that this is the most appropriate way to do it, but it works.
Once I reached the login screen the 'DEBUG_SEESION_START' and 'KEY' as part of my url were lost.
I simply let the page load up, copied the 2 url parameters onto the end of the url and hit enter.
2 days of head-banging. I hope this saves someone else. I wouldn't wish what I went through on anybody.
I'm currently in the process of moving my webserver from an on-premise solution AWS EC2. I've installed an ec2 web-server with VestaCp admin panel that configures Apache & Nginx.
Everything seems to work, except a request sometimes seems to get 'stuck'. Meaning I click on a link, and instead of navigating to that link it's added to my chrome network tab in pending state, here in the picture below you can see the pending web request that was triggered by a click on an a href, and instead of navigating to it it's stuck at pending state for more than a minute!
While this is happening, the browser is showing a "waiting for mydomain.com" in the bottom left corner.
I've tried moving the session to be saved in memcached (instead of file), and enabled opcache, but really haven't been able to debug this properly and nail down on the problem (I just had an hunch it might have something to do with a locked file and someone waiting on the lock). I haven't been able to find something relevant in the apahce error logs. I've also tried chrome net-internals sockets view, but it doesn't seem it's being stalled. During debug I've managed to track the a href click and the Apache access log, and noticed the request doesn't reach the Apache Access log, meaning it probably gets stuck in the client (unless the access log only updates when the request finishes)
What can cause this? What are ways to debug deeper?
Had exactly the same problem, nginx gets stuck sometimes for exactly 60 seconds.
In the end the problem was solved after I added "resolver" directive to nginx. Not entirely sure about the actual mechanism that caused this problem.
I work on PHP code with NetBeans and Xdebug. I use Xdebug for step-by-step debugging and the like.
I'm able to debug the flow of the default request, but not the flows generated by specific _get/_post or Ajax requests.
Anybody has an idea how can this be done?
When I run the debugger, a tab in my browser opened automatically with the following URL:
http://localhost/?XDEBUG_SESSION_START=netbeans-xdebug
Thanks.
Gidi
Ok,
it goes this way:
At the projects tab (top left of the screen in my configuration), right click on the name of the project, and then properties => run configuration
There you have to fill 3 forms:
1. project url - the base url of the project on web, typically http://localhost
2. index file - use the browse button and go to the local copy of index.php or whatever file serves this role for you. This form should contain the path to this file in the local filesystem , not on the web
3. arguments - any arguments you wish to path to your script through the URL
This should give you the ability to choose a custom URL for debugging
A possible problem: in this process you may loose the synchronization between web addresses and the corresponding files in your system. Google "path mapping in php debugger" if you encounter issues of this nature, and take the first result (which the system wouldn't allow me to link directly).
However this didn't work for me. I used server configuration to overcome this issue by redirecting URLs
Gidi
p.s.
All the above doesn't explain how to pass POST variables to your script while debugging (and I indeed don't know how to do it)
Perhaps you try to start a debug session as described above. As debug target you choose the nearest page to your POST request in the workflow. Then you interact with the web service, always having the debugger in netbeans running. With the interaction the debug session holds on, so you can fill forms etc. and send the POST request. Then switch to netbeans and debug as usual.
Perhaps you have to enable 'Break at first line' in the debug options, or set up a breakpoint in the php code, where the request is dispatched, in order to ensure the debugger halts while dispatching the POST request. Then you eventually will have to give the debugger a push at every page load.
Hope it helps