Solution if you get a blank page when running CakePHP3 on IIS

Sep 6, 2020 PHP CakePHP IIS iis10 CakePHP3.

0. Introduction

When I was advancing the CakePHP3 tutorial while looking at various sites, I typed ** localhost / cms **, but ** a blank page was displayed **. Moreover, even ** localhost/phpinfo.php ** was ** pure white ** in the first place.

However, is it rare to use IIS when using CakePHP3 to investigate the cause? I couldn’t find a site that describes how to solve my phenomenon.

From the conclusion, it was ** IIS setting insufficient **, but I had a hard time finding it, so I will write it here. However, note that ** I have not written the entire method of running CakePHP3 on IIS **. (Maybe I’ll put a link later, or I’ll put it together myself)

1. Handler mapping

First, regarding ** phpinfo.php **, ** handler mapping settings ** were leaked. I haven’t investigated it in detail, but it seems that **. Php module mapping ** must be included in the settings. The setting method is briefly described below. Those who have solved the problem with just the above words can proceed to the work.

1. Select handler mapping from IIS

image.png

2. Select “Add Module Map” from the menu on the right

There are many similar ones, but select ** Add Module Map **. By the way, the module map to be added this time is selected in the list on the left. image.png

3. Enter the required items and press the OK button

The image is from a module map edit, Please forgive me because it has the same configuration as adding a module map.

Enter the ** request path ** and ** module ** in ** as shown in the image **. For ** Executable file (optional) **, enter the path of your environment in Reference **. ** Name ** is optional. I named it PHP appropriately. image.png

That’s all for setting the handler mapping. Now if you jump to localhost/phpinfo.php you may see your PHP settings. (Although it is a premise that phpinfo.php is created)

2. Default document

I didn’t come up at all whether this was really the foundation of the foundation. There is URL rewriting, and there is no problem with web.config, so why not jump to ** localhost / cms **! It was supposed to be. Simply put ** put index.php in the default document **. That was all. This is also explained briefly as before.

1. Select a default document from IIS

image.png

2. Select “Add” from the menu on the right

image.png

3. Enter “index.php” and press the OK button

image.png

This is OK. The URL will be rewritten safely and you should be able to open ** index.php ** just by typing ** localhost / cms **.

9. Finally

As I wrote at the beginning, this is just a summary of the parts that took a long time to find. In order to really run CakePHP3 on IIS, various other settings are required. (That’s why there are some difficulties in URL rewriting and DB connection …)

Well, I wrote a lot, but I tried to summarize it if I could help someone who is stumbling in the same place as me. I hope this article has helped anyone to reduce the amount of time that development is stagnant.

This is the first article, so if you have any suggestions, such as things that are difficult to read as sentences, please do not hesitate to contact us.