How to make PHP Available with CommandBox Server?

I have a client who has both CF and PHP pages on their website. I’m trying to create a local dev environment for their site on my pc. I have IIS 7 enabled and PHP installed in it, and I thought Brad’s Youtube video “Running CommandBox servers behind IIS” (Screencast - Running CommandBox Servers Behind IIS - YouTube) might be the answer. But after I have BonCode installed and everything configured for AJP in server.json, the CF pages in my root can be read by the CB server, but the browser says “not found” when I try to view PHP pages in the same folder.

Now, I did things a little differently from the video; I kept the default web site in IIS pointing to inetpub/wwwroot, because PHP doesn’t work outside of wwwroot and its subfolders. Also, while installing BonCode, it mentioned ASP.Net as a requirement and created a folder in wwwroot, “aspnet_client”. So with CB I thought I’d first try to navigate to inetpub/wwwroot/mysite, and started the server there. I figured the important thing is just that IIS and the CommandBox server are pointing to the same folder.

Should BonCode make it possible to use PHP in the same root as my CommandBox server? Is there a simpler way to do this?

Where is this error coming from? IIS? CommandBox? PHP? Can you share a screenshot?

Generally speaking, this should work and Boncode will only proxy requests to .cfm or .cfc files. As to how you’ve configured IIS to process PHP files, it’s hard to comment there.

I’m not sure; I want to say it’s from CommandBox:

If it should work, I’ll try reinstalling BonCode and try again. PHP installation in IIS was fairly straightforward-- I downloaded PHP Manager, installed it into IIS, then downloaded php-7.1.7-Win32-VC14-x64 (this is the same version of PHP the client’s using). To register this version, In PHP Manager, in PHP Setup, I entered the full path the php exe file, which is C:\php-7.1.7-Win32-VC14-x64\php-cgi.exe. After that, I tested and found PHP pages can be read in the IIS default website (which is pointing to wwwroot) and in wwwroot subfolders. So I know PHP is working in wwwroot and below. The only thing I need now is to get a CommandBox server in a wwwroot subfolder and get CF working, too.

Slow down. :slight_smile: That is from CommandBox, and looking at the port number, you’re not hitting IIS in your browser!! Back up and hit the site through IIS so Boncode can send the CF traffic to CommandBox and the PHP files to PHP.

Obviously, CommandBox is not going to be able to serve up the PHP files.

Okay, I uninstalled BonCode and reinstalled anyway, because I wanted to make sure that I made the right selection for the “Global or Specific Site” option. I followed your example and created a folder “iissite1” outside of wwwroot, and pointed IIS to it. Everything was going fine, I installed BonCode, and then I tried to hit localhost in my browser. I got a message saying that it couldn’t read the web.config file because of permissions, so I right-clicked on web.config, went to properties > security, and added IIS_IUSRS:

But now everything is wonky. Localhost just spins and won’t come up in my browser. And “” (which I thought is the same as localhost??) goes to the IIS graphic:

I know IIS_IUSRS is supposed to be a local group tied to the local machine and not to a corporate domain. But I can’t search for users anywhere but in that location:

Okay, finally got it working. I don’t know what the problem is with creating a site outside of wwwroot; seems like a Windows permissions issue I’ll have to work out later. But I managed to start from scratch, created a folder under wwwroot, configured a CB server in that folder to enable ajp in server.json, pointed the IIS default web site to wwwroot/IISSite1, installed BonCode, started the CB server, browsed to localhost, and now both PHP and CF pages render as they should.

@bdw429s I understand what you’re saying – I don’t want to look at that site through the random port that CB gives it, because the CB server can’t read the PHP. Rather, I want to start the server, but look at the site through localhost, so that IIS will read and render any html and php pages, but will pass on .cfm and .cfc pages to be handled by the CB server.

For posterity - I figured out the permissions issue, and I now have both PHP and CF running in a site outside of wwwroot, thanks to BonCode. BonCode’s the way to do PHP with CommandBox; thanks for that great video @bdw429s.

It seems there’s an issue with my browser (Avast Secure Browser) sometimes hanging and not loading pages (does it with this website sometimes, too), which is why it was hanging before. I typically have to close the browser and open again when this happens. Also, my “Sites” folder (where I keep most of my local dev sites, in C:\users\cmaso) needed view and execute permissions granted to “IIS_IUSRS” and “IUSR” (right-click folder, properties, security tab).