Excel file is not generating in IIS server. Throwing 500 error.

Topics: Developer Forum, User Forum
Sep 5, 2010 at 5:41 AM


Excel file in my project was generating and opening successfully in the xamp & apache server. We have moved the code from xamp to IIS server. Everything in the project was working, but the excel report is not woring. It it throwing 500 server error. The same code was working earlier properly.

Internet research is discussing about some error in the code which is causing this fatel error. Any suggestion on how to see the actual PHP error in the log is appreciated. As of now it is just showing the error message as 500 error and some suggestion on IIS settings. I have checked the IIS setting with the admin and everything is good. MS office 2007 is also installed in the IIS server.

Any help is much appreciated.


Sep 11, 2010 at 7:50 AM

To determine where your IIS log files are stored, perform the following steps on your server:

  1. Go to Start -> Control Panel -> Administrative Tools
  2. Run Internet Information Services (IIS).
  3. Find your Web site under the tree on the left.
  4. Right-click on it and choose Properties.
  5. On the Web site tab, you will see an option near the bottom that says "Active Log Format." Click on the Properties button.
  6. At the bottom of the General Properties tab, you will see a box that contains the log file directory and the log file name. The full log path is comprised of the log file directory plus the first part of the log file name.


(It is probably a directory mapping issue for a file you are requiring)

Sep 11, 2010 at 11:03 PM

Thank you for your input.

While troubleshooting the issue, I found that the error is due to the below code. It is not able to save the report properly. If I comment out this line of code then the System 500 error is not displaying.

$objWriter->save(str_replace('.php', '.xlsx', $finalreportname));

$objWriter->save($finalreportname); - The code without the string replace is also not working.

Is this related to some file/folder permission. I am saving the report in a folder name 'report' which is under the project folder. Can this be related to some permission?

Any solution approach or suggestion to resolve this issue is much appreciated.

Sep 12, 2010 at 11:05 PM

The issue is resolved. It is a permission issue to the folder. Since I am new to the IIS server setup it took a while to identify it. In IIS server, right click your root server folder and then select Security tab. Then you can give write permission to the folder. By default it will give permission to all the sub folders

For any future users:
f you are getting similar error especially on any new file generation either fopen or complicated excel report, try to do a simple fopen code to make sure that you have proper permission.

Thank you trothman for your suggestion.