Php path wrong when opening caddy.exe

This is a windows system and a new caddy install.

i am trying to get PHP to run when i open caddy. I have it working on my own machine, i was trying to help a friend yesterday, as far as i can tell his is set up exactly like mine but doesn’t work the same.

in the caddyfile this line is the line tries to open PHP:
startup /caddy/php/php-cgi -b 127.0.0.1:9000 &

Caddy.exe echos that “c:\php… cannot be found in Unknown on Line 0” and repeats for each dependent file
The problem is that php is at c:\caddy\php and not c:\php. I don’t know where its grabbing that root path from.

We attempted last night to make another php folder at c:\php just for the sake of seeing what happens and the error goes away and caddy opens properly. In this situation PHP still doesn’t parse though. When i navigate to index.php it displays it as a text file in the browser.

I’m certainly it’s just my lack of knowledge about something simple kicking my butt here. Any recommendations form the more knowledgeable folks?

Thanks all.

Will startup /caddy/php/php-cgi [...] work on Windows? Shouldn’t it be something like startup C:\caddy\php\php-cgi [...] instead?

Also keep an eye out for on, which will soon be replacing both startup and shutdown: https://caddyserver.com/docs/on

My friend ended up going back to nginx and just using cloudflare for SSL.

Another guy who assisted said he just uninstalled PHP then did a fresh install and that portion seemed to be better. Not sure what is in a PHP install hat provides its own paths but it must have been hiding in there somewhere.

That path will work fine as i am also running windows and that’s what my caddyfile contains. I also attempted the absolute path there on his install though (with forward and backslashes just for good measure) and saw no change in result.

Thanks for your reply.

1 Like

Ahh, interesting, thanks for that info. I don’t run much on Windows, so I wasn’t sure.

Forward and backslashes shouldn’t be an issue, I believe Go’s filepath library handles all that automatically, it was really the C: I was thinking could be a problem.

One thing I’d strongly recommend, if he’s going the CloudFlare SSL route, is to get a CloudFlare Origin CA certificate:

https://blog.cloudflare.com/cloudflare-ca-encryption-origin/

The benefit is because it’s a CloudFlare CA cert, he can get one that’s valid up to 15 years, so it’s a set-and-forget deal and he’ll have fully secure HTTPS every step of the way from his server to the client.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.