IIS+PHP random Error 500.19 - php

I'm running a WIMP stack on Windows Server 2012 R2 Standard, and I have a strange issue with IIS: After working for a random period of time (usually from several hours to days), most requests start to give the following error page:
What is weird is that it works for a period of time. Changing the user access settings of web.config or restarting the website both work to resolve the issue temporarily, however it's a recurring problem.
I do realise that WIMP is not the most desirable stack (normally I'd opt for LNMP myself), however our website will be migrated to an ASP.NET app soon, and since we had to do a server upgrade beforehand, we opted into installing Windows on it to make the transition faster.
EDIT: After some testing, changing the NTFS permissions result in getting the same error until the website is restarted. Might have to do something with the issue?
Also, I'm running the website with a pre-selected user rather than pass-through, if that helps.

Related

How to troubleshoot performance difference between 2 web servers?

I have a production virtual web server that is being migrated to a new virtual web server on the same local network. The problem is that there is a performance problem on the new server.
For example, there is one page that loads in about 1 second on the original server, but takes over 25 seconds to load on the new one. I have already ruled out the database connection as the problem.
Both servers are Ubuntu Apache servers running PHP. There are slight differences in the versions of the servers, I will list as best I can here.
My main question is: is there a general way to profile the web requests on each server?
Similar to the way I can profile a python script or function and get a break-down of which parts of the program take the most time, I would like to profile the web requests on one server compared to the other.
Of course a web requests to the server are fundamentally different than programs run on a local computer, but I need to find where the bottleneck is. Any help is greatly appreciated.
Old Server Config
Ubuntu 14.04 - PHP version 5.5.9
New Server Config
Ubuntu 16.04 - PHP version 5.6.31 (also tested with version 7, same result)
I would suggest to log PHP script execution time.
If it comes from somewhere in the PHP execution, you will notice it easily.
Do a log at the start and one at the end. Then you can stress test both and see different execution time.
I seriously doubt the problem comes from PHP but if you do that you could also see differences with PHP7 which should be 30% faster.

upgraded to PHP7 on Windows: php_soap.dll causing crashes / frequent 500 errors

I have two servers, a test server running Windows 7... and a prod server running Windows Server 2008. (Yeah, it's unfortunate that they're different OS's.)
For months now, they've been running on PHP 5.4.1.4.
I decided to upgrade them to PHP 7. Everything went completely fine with the test box. But of course, it doesn't get much traffic.
On the prod / Windows Server 2008 box, it seems like, web apps would run for a minute or two and then show "500 error". I could refresh and sometimes they'd work again, sometime it'd take a few minutes.
Nothing is/was getting written to the NEW PHP error log (even though IIS's PHP Manager section showed that we were pointed to the correct INI and the correct log file).
The webserver failed request logs simply indicated that FastCGI was failing because of too many 500 errors.
I checked Event Viewer and I would see application crashes that would point to php_soap.dll.
Now, that file is THERE and it's the same size as the one I have over in non-prod.
Still, I thought perhaps it was because my scripts were getting 500 errors for a valid reason. So I investigated one of them. Confirmed that it was an exact match to a working one on the test box. Refreshed it...and it worked fine. Refreshed some more, 500 errors.
So, finally, I went into IIS Manager -> PHP Manager and disabled the SOAP extension.
I then STOPPED seeing the massive number of failed requests and I stopped seeing the 500 errors... for everything except the one script I have that makes SOAP calls.
I tried copying the dll from the test box over to the prod box. Enabled the extension again in PHP. The issue returned. So, I've pointed us back to the 5.4.1.4 config for now.
Any ideas on how I might figure out why this dll is causing issues and/or how to fix it?
Thanks!
-= Dave =-
I know this is old now but I had a similar problem and it turns out that the cached WDSL files are not binary compatible between versions of PHP.
By default in php.ini the SOAP module has caching enabled. In order to avoid a crash you'll either need to clear the current WDSL cache or change the cache location for the new PHP install.
Hope that helps...
I think I figured out a fix. I'm not sure why I'm only having to do this on the prod server, though: The directories that my scripts that make SOAP calls are in were set to allow both Anonymous Authentication and Windows Authentication. When I was manually testing things in my browser, it would accept me and run the script as Anonymous.
I suddenly realized a theory: my erroring script was being called by remote desktop gadgets...so it was probably defaulting too to executing anonymously. But I have another script with SOAP in it that's run by Scheduled Task (as a specific user). I had NOT seen that erroring!
So, I turned off Anonymous Authentication on the directory I was testing and reran my script from my browser. Sure, I had to log in, but it then worked! I checked my version of the Desktop Gadget that calls a SOAP script in that same directory...and it was now working too!
I think the key reason why I did not see this on the test machine is that we really don't have any Desktop Gadgets pointed to those proxy SOAP scripts over there. That, plus I had THOUGHT that my script that runs by Scheduled Task was failing on the prod machine, as I know I saw it throw 500 errors within the first few minutes after I activated PHP7 the first time....and that same Scheduled Task/script DOES run over on the test box.
Thanks!

Diagnosing "The connection to localhost was interrupted"

I've been developing a Laravel 4 site on my work machine for over a year. Today I began receiving a The connection to localhost was interrupted error whenever I attempt to access the site. At the moment I'm just trying to find applicable log files that might tell me what's failing, and would appreciate suggestions from those more versed in tracking down this kind of failure. You'll see one possible cause below, but I still need to find some error logs to have any idea how to fix it. Here are some pertinent details:
I'm running Windows 7, IIS 7.5, PHP 5.5.1, and Laravel 4.1.23.
The application is accessed via https://localhost/ephy, and IIS is configured to deliver the ephy directory over SSL.
http://localhost/ephy correctly returns a 403 error indicating that the page must be accessed over SSL.
When copies of phpinfo.php (containing just a call to phpinfo() ) are placed in both the root directory and the ephy subdirectory, http://localhost/phpinfo.php executes, while https://localhost/ephy/phpinfo.php returns the connection reset error.
The application itself is executing successfully on the production server, so the PHP code is valid.
Yesterday I installed Office 2013, uninstalled Office 2010, uninstalled Office 2013, and then reinstalled Office 2013 (in that order). I also installed 2 GB of memory, because Outlook 2013 kept hanging.
The site was accessible as of 4pm yesterday, after all of that installation activity was already over.
I've made no changes to the application or the computer configuration since 4pm.
I've restarted the computer several times.
I've checked the files in C:\inetpub\logs\LogFiles , but they don't show any error messages.
So, I know PHP is running successfully and that the issue is specific to serving the application directory itself, but that's as far as I've been able to get. Recommendations on where to find (or how to generate) logs which would indicate what's happening, or any insights into the failure itself, would be appreciated.
Ok, after finally finding the magic combination of search terms on Google (ERR_CONNECTION_RESET localhost iis 7, for those who are curious, the first term being the error message from Chrome specifically), I was able to determine that this behavior can be caused by not having the self-signed security certificate correctly bound to the site in IIS. As I said, the site had been working successfully, but with the software updates I'd done something probably got borked (maybe adding the memory changed the computer's identity such that the certificate was no longer valid? I don't know).
So, I followed the instructions at http://weblogs.asp.net/scottgu/tip-trick-enabling-ssl-on-iis7-using-self-signed-certificates (with a bit of adjustment because apparently the binding has to be done at the default site level in IIS 7.5, rather than at the individual site level), whacking and replacing the existing certificate and SSL binding in the process. The site is now working again on my box.
So, in a nutshell: if you're running SSL on localhost under IIS and you get "connection to localhost was interrupted" messages, try redoing the certificate and binding.
Man, glad that's over...

Apache deflate and progressive HTTP response

I work on an e-commerce website and we have important performances difference between our production server and our test server.
Both are VM running on Windows Server 2008 R2 64bits with WampServer 2.5 (Apache 2.4.9 / PHP 5.5.12).
(Note : I know that WampServer is not for production uses, but at this time it's still the best solution for us as we highly depend on Windows environment for our databases and other stuff. We tried to optimize Apache & PHP configuration for production, and we replicated that conf on our test server, so we have the same environment on both machines.)
Everything was running okay from there, until today. We were attempting to improve Apache files compression configuration (disabling it on images, enabling on html files, etc) when we noticed a major difference between the two servers.
On the same page (for test needs : an huge products list with a lot of content and images to display), same request, same user, same browser :
The production server seems to "prepare" the whole document before sending it. During several seconds I've to wait and watch a blank browser, then all shows up instantly. In Chrome Dev Tools, Waiting time is around 7 sec and Receiving time around 50 msec.
The test server seems to do just the opposite : no blank page during seconds, the header is displaying very quickly and the rest of the content comes step by step while I can already browse the page. Waiting time is around 200 msec and Receiving time around 11 sec.
On my own development machine, I can observe both situations when I toggle Apache's configuration for mod_deflate.
So after several attempts, we just disabled the mod_deflate on the production server, and then on the test server. Both have the exact same configuration, and still there is this big difference.
I also looked on php.ini files, thinking about cache issues or something like that, but same deal here : both configuration files are matching but the two servers are still working differently.
We spent hours searching answers on the web, but nothing seems to work...
Please, can somebody help us on that ?

MySQL Abruptly Refusing Remote Connections

UPDATE
So I completely disabled my server's firewall and it appears to be the culprit. I had tried to disable certain rules before but disabling the whole thing worked. Very frustrating, but problem solved I guess... I think the key indicator that it was the firewall was because it happened at exactly midnight when my server likes to apply updates and such.
This is pretty strange to me, I have a server downstairs that hosts my websites and MySQL servers and it has been running for years without many issues. I have 2 routers bridged together behind my modem and my server is behind one of them. All other devices connect via WiFi. All of the proper ports are open on the router and I have users configured in MySQL that haven't changed and have been working fine this whole time.
So last night I was working on a project and I decided to sync everything with a backup on my SkyDrive. I have a scheduled backup for MySQL that runs at midnight (daily) and it just turned over to midnight so I decided to open my network and watch the file get populated before I sent a copy to my SkyDrive. After the backup was complete (which it did successfully), I was going to continue to work on my program but all of a sudden I can no longer connect via my local network to the MySQL server. I'm using PHP and my connection string never changed and all other MySQL admin tools don't connect. The live site works fine, so MySQL was definitely running and working but no remote connections were being accepted. Why is this happening all of a sudden?
Things I've tried :
I did notice that my logs were packed full of BINLOG errors so I turned off the binlog since I recently turned it on (a couple weeks ago).
Restarting MySQL
Turning off Windows Server 2008 firewall (temporarily)
Connecting from a different device (mobile phone, tablet), no luck
Temporarily allowing port 3306 on my router
Checked server logs for intrusion attempts, none present...
Setup :
PHP 5.4 on local machine and server
Windows Server 2008 Enterprise (on server...)
MySQL Version 5.5.25a
Does anyone have any clue as to what's going on here? I'm going to reboot my server when the load is low and see if this helps any, I will update this once it comes back online.
So I completely disabled my server's firewall and it appears to be the culprit. I had tried to disable certain rules before but disabling the whole thing worked. Very frustrating, but problem solved I guess... I think the key indicator that it was the firewall was because it happened at exactly midnight when my server likes to apply updates and such.

Categories