Skip to content
This repository was archived by the owner on Oct 8, 2025. It is now read-only.
This repository was archived by the owner on Oct 8, 2025. It is now read-only.

error using symlink for script with php #650

@rbro

Description

@rbro

I am using Unit with PHP, and running into an issue where if the script is using a symlink, I get an error "script is not under php root".

My unit configuration is:

{
    "applications": {
        "exphp74": {
            "type": "php 7.4",
            "user": "nobody",
            "processes": 2,
            "root": "/var/www/html",
            "script": "app/start.php"
        }
    },
    "listeners": {
        "*:8374": {
            "application": "exphp74"
        }
    }
}

/var/www/html/app is a symlink to /tmp/app. When I try to apply the above configuration, I get "Failed to apply new configuration." and unit.log has "script is not under php root".

My guess is because realpath is returning the actual path to the file even though it's also under the root through a symlink.

Is there a way to have Unit still consider it as under the php root even though it's a symlink?

I did notice that if I create /var/www/html/app as a real directory with start.php in it, apply the configuration, and then switch it back to a symlink, then all works correctly.

Thanks for your help.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions