I've added extensions to my php.ini file and I need to restart my IIS server. Is it safe to re-start IIS? Will I lose any information or am I just being over-worried? All I need to do is open IIS Manager, select server, click "action" in the menu > View tasks and click restart IIS?

link|improve this question
2  
I would say it depends on the running (PHP) code: if database transactions are not being correctly used (or other non-atomic actions are assumed to be atomic), then all bets are off for a long-running instance that is forcibly terminated. I'm not sure what grace period a restart provides. – pst Jan 16 at 20:17
By the way what do you meen by safe? are you running any other sites on the server? – Emmanuel N Jan 16 at 20:19
Belongs on serverfault. – webbiedave Jan 16 at 20:20
See my "safe" definition below... I haven't a clue what pst talking about (my knowledge on servers is down to a bare minimum). – Dale Hughes Jan 16 at 20:47
feedback

migrated from stackoverflow.com Jan 16 at 20:32

This question came from our site for professional and enthusiast programmers.

4 Answers

up vote 5 down vote accepted

It would really depend on your definition of "safe".

Will it break anything? It might if you haven't configured it correctly. However an IIS restart is usually quick and painless, it will break running sessions in most cases (.NET sessions). But really it depends on what is running and the dependencies.

For the most part, an IIS restart is 'fine'.

I guess that's the best answer I can give without knowing your full "safe" definition expectations.

link|improve this answer
Ok well when I mean "safe", I mean we have a few databases in our MySQL and the last thing we want is for our databases to malfunction or not work once we restart IIS. It would be a nightmare if we restarted and all our website don't work and then we'd have to re-create all our databases. I can't understand why microsoft would let a system work like what Emmanuel N quoted above! So I'm not sure what to do! I just want to add an extension to my php.ini file and I know you have to restart the server for those extensions to take effect. Ehow say: ehow.com/how_4713031_restart-iis.html – Dale Hughes Jan 16 at 20:42
Don't worry about the databases, they will be fine. An IIS restart is acceptable, it is classified as a "severe" action as it causes a temporary outage for IIS services (not MySQL!) – Jakub Jan 16 at 21:20
@Dale, I don't think there's much more Microsoft can do. When you restart a server, all clients are disconnected. And if you have poorly written applications that are misusing transactions, you can have problems. – dsolimano Jan 16 at 21:22
Ok, well you see, its not like we have HUGE databases or are using any e-commerce scripts or payment gateway scripts for our websites. If our websites are down during the re-start, then we are ok with that. I just worry that it'll effect our small databases (like CMS and comment scripts) / hmailserver or any important settings thats makes our server as it is now. – Dale Hughes Jan 16 at 21:39
@DaleHughes, again, you are fine to restart IIS, its just like a server reboot (except less outage, and only limited to IIS). – Jakub Jan 16 at 21:50
show 1 more comment
feedback

According to this Microsoft technet article

"Restarting or stopping IIS, or rebooting your Web server, is a severe action. When you restart the Internet service, all sessions connected to your Web server (including Internet, FTP, SMTP, and NNTP) are dropped. Any data held in Web applications is lost. All Internet sites are unavailable until Internet services are restarted. For this reason, you should avoid restarting, stopping, or rebooting your server if at all possible. IIS 6.0 includes application pool recycling and several other features that provide alternatives to restarting IIS. For a list of features designed to improve IIS reliability and remedy the need to restart IIS, see "Alternatives to Restarting IIS" in this topic."

link|improve this answer
Severe?? Thats crazy! Why can't we restart like a program and not lose important information!! By the way we have IIS 6.0. I am "green" when it comes to servers or IIS for that matter – Dale Hughes Jan 16 at 20:45
1  
IIS 6.0 is version of IIS, the most recent one I think is IIS 7.0. You can restart but is not recommended especial if you are running multiple sites. What you can do is recyle your application pool or do other things suggested on that post – Emmanuel N Jan 16 at 20:50
Ya, like I said, I'm "green" in this field so its something I wouldn't want to fiddle with to find I've performed a "severe action". – Dale Hughes Jan 16 at 21:14
feedback

An IISRESET (the command line tool designed to restart IIS) is a pretty severe action. You ask your web server to shut down, and if it does not manage to do so in a timely manner, the core service processes are killed and restarted sequentially. If you need to reload a specific site configuration, or reload an isolated application domain, issuing an IISRESET command is like cracking open a nut with a sledgehammer!

First of all, all virtual memory held by the processes serving your applications is flushed. This means that all session data is lost and all users currently connected and authenticated on all websites on the server will experience that they have been logged off, or their shopping basket emptied, or whatever functionality that depends on temporarily stored data. Furthermore, if you force a restart of the web server, or the initial attempt to restart it gracefully times out, clients will experience a sudden loos of connectivity with any application hosted on the server. To get around these issues, the concept of worker process isolation that was introduced in IIS 6.0 can come in handy.

If you want to reload application specific configuration files (eg. web.config), or just need an application that has crashed, deadlocked or experiences any other type of resource exhaustion to get back on top, try recycling the application pool serving your web application instead. Recycling an application pool is an overlapping recycling action which simply shuts down the W3 Worker Processes serving the application pool gracefully, that is: current requests will continue to execute until the queue is empty. In the mean time, the application pool is allowed to spawn a new worker process to serve subsequent requests, and the http driver re-routes all application requests to this new process.

With this you can accomplish virtually no down time, while at the same time introduce configuration changes granularly and only affect the application you are reconfiguring and not all other applications

This MSDN Blog Post explains some of this rather nicely

link|improve this answer
1  
+1 for Always Recycle First. Recycling is 99% of the time all that's needed to restart or recover a given application. – TristanK Jan 17 at 1:14
feedback

If you don't know what behaviour to expect when you preform an IISRESET or even a server restart then you absolutely need to find out!

There are going to be many occasions where you'll need to reset your website or the server, patches and upgrades, unscheduled downtime, issues with the environment such as power failure and you'll need to be confident that such a restart will set your site back to a known and stable state.

So in answer to the question, yes, restart is safe in that the server will restart your application and as Jakob points out this won't effect the MySQL databases. How your application deals with a restart will depend on how the site has been developed.

I'd also recommend restarting the MySQL engine (after taking full backups of course) to ensure your site works as expected afterwards.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.