Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

serverBasePath #27

Closed
udf2457 opened this issue Jun 14, 2016 · 3 comments
Closed

serverBasePath #27

udf2457 opened this issue Jun 14, 2016 · 3 comments

Comments

@udf2457
Copy link

udf2457 commented Jun 14, 2016

Hmmm...

I'm not too keen on your prescribed base path. If I don't set one (and your class doesn't seem to provide a "setter" for $this->serverBasePath !!), I don't think you should be making assumptions ?

Case in point is that on NGINX, your class ends up setting moving goalposts.

A PHP script with "implode('/', array_slice(explode('/', $_SERVER['SCRIPT_NAME']), 0, -1)) . '/';" will print /demo/hello/ for a URL suffix /demo/hello/x and /demo/ for URL suffix /demo/.

This is when NGINX is configured in-line with their recommended methods (http://nginx.org/en/docs/http/ngx_http_core_module.html#try_files)

    location /me {
        try_files $uri @mystuff;
    }
    location @mystuff {
        fastcgi_param SCRIPT_FILENAME /path/to/mystuff.php;
        fastcgi_param SCRIPT_NAME /mystuff.php;
        fastcgi_param  PATH_INFO        $fastcgi_path_info;
        fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
        fastcgi_param QUERY_STRING    $args;
        include fastcgi_params;
    }

Changing
fastcgi_param SCRIPT_NAME /mystuff.php;
to
fastcgi_param SCRIPT_NAME /me/;

Has no effect.

@bramus
Copy link
Owner

bramus commented Jun 14, 2016

This looks like an NGINX configuration problem, as the value for serverBasePath is calculated automatically based upon the path where your script is located at and works fine with Apache, IIS, and the built-in PHP webserver.

Feel free to report back with the correct settings, as I'm unfamiliar with NGINX. A quick Google Search points me towards http://stackoverflow.com/a/16171164/2076595, perhaps that could be of help?

Regards,
Bramus.

@udf2457
Copy link
Author

udf2457 commented Jun 15, 2016

Not too sure it is an NGINX config problem, I think its very much your presumption of using the file path. But anyway, at the very least you should be providing a setter to enable people to override your presumptions.

@udf2457 udf2457 closed this as completed Jun 16, 2016
@bramus
Copy link
Owner

bramus commented Jun 16, 2016

Hi @udf2457,

I see that you have closed this issue, leading me to assume you got it fixed. Could you share the solution, in order to help people who have the same issue in the future?

Regards,
Bramus.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants