Caddy 2.5 with PHP7.4 problemes ... only one directory not working

1. Caddy version (caddy version):

2.5.0

2. How I run Caddy:

I run caddy as a service, the configuration is placed inside the Caddyfile

a. System environment:

It runs as a systemd service on Ubuntu 20.04, with PHP 7.4

d. My complete Caddyfile or JSON config:

test.domain.tld {
  root * /var/www/test.domain.tld/docs
  file_server browse
  encode gzip
  log {
    level debug
    output file /var/www/test.domain.tld/logs/access.log
  }
  tls /etc/ssl/certs/domain.tld.cabundle /etc/ssl/private/domain.tld.key
  php_fastcgi unix//run/php/php7.4-fpm.domian-tld.sock
}

3. The problem I’m having:

I have a realy strange behavior. I’m runing php7.4 as FPM. The configuration above seems to run. In my php project exists a folder called run.phpIncludes. This folder is a subfolder of the document root. If i placed a file inside this folder with the content echo “test” and try to open it in the browser i get a “File not found” error. For me it seems that the permissions are not correct, but if I rename the folder to php.xrunIncludes the files are accesable and works. I don’t know why this “directory” is not working.

4. Error messages and/or full log output:

If i access the file test.domain.tld/run.phpIncludes/test.php I get a “File not Found” error

5. What I already tried:

For testing I tried to give the whole Director (and recurse) full permissions 777. I changed also the user and group to caddy:caddy

Are you saying you have .php in the path twice? That would be the problem then. The PHP logic splits the path on the first .php it can find in the path, so if you have that in a directory name, it’ll mess up.

Read more here:

1 Like

hi @francislavoie

thx a lot for your hint, yes I have .php in the path twice. If i understand it right, there is not realy a way to handle this exception?

Again thx for your correct answer. I will speak to the developer to rename this directory.

Yeah. I’m sure it would be possible to craft a workaround for it, but I strongly suggest just not using dots in directory names in general, especially when used in request paths. It’s usually confusing.

1 Like

This topic was automatically closed after 30 days. New replies are no longer allowed.