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

Makes temp dir configurable #165

Closed
wants to merge 2 commits into from

Conversation

jaapio
Copy link

@jaapio jaapio commented Dec 7, 2016

These changes make it posible to set the temp dir used by
the glide server to store images for processing.

Since this must be a local path we check if the path exists and is
writable by php. Otherwise an exception is thrown.

By default the tempDir property is set to sys_get_temp_dir() so no
changes are required for existing systems.

Fixes #156

These changes make it posible to set the temp dir used by
the glide server to store images for processing.

Since this must be a local path we check if the path exists and is
writable by php. Otherwise an exception is thrown.

By default the tempDir property is set to sys_get_temp_dir() so no
changes are required for existing systems.
@reinink
Copy link
Contributor

reinink commented Jan 20, 2017

@jaapio Out of curiosity, what host were you having these issues with? I honestly thought there was a standard way of getting the available temp directory on any PHP based web server.

@jaapio
Copy link
Author

jaapio commented Jan 21, 2017

We are using mod-ruid to let the application run as the owner of the files. This user has a base_dir restriction so php is not allowed to access /tmp

@anhphamt
Copy link

I also get this issue when working in my local environment OSX. It's fine when working with Host.

Can we merge this pull request so that dev can adjust the tmp dir dynamically.

Thank you

@jorenvh1
Copy link

jorenvh1 commented Jun 6, 2017

Can anyone explain me how I would go about using this fix to set the tmp folder in the root of my laravel project for example?

@hykw
Copy link

hykw commented Jun 11, 2019

We've also got the issue. Could you merge this pr, please?

@piotr-cz
Copy link

I wonder why Travis builds failed here.
Job logs are not available anymore.

@piotr-cz
Copy link

Nasty workaround:
Include file which defines sys_get_temp_dir function in League\Glide namespace, so it's used instead of native function.

<?php
namespace League\Glide {
    /**
     * Monkey patch temp dir on shared hosting (open_base conflict)
     * @return string
     */
    function sys_get_temp_dir(): string
    {
        $nativeSysTempDir = \sys_get_temp_dir();

        // Your detection mechanism
        if (strpos($nativeSysTempDir, '/home/fcgid/') !== 0) {
            return $nativeSysTempDir;
        }

        return ini_get('upload_tmp_dir');
    }
}

@tgalopin
Copy link
Member

This sould be fixed by #304, can anyone confirm?

@tgalopin tgalopin closed this Jan 23, 2021
@jaapio jaapio deleted the feature/156-system-tmp-dir branch January 24, 2021 14:34
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

Successfully merging this pull request may close these issues.

Server temp dir should be configurable
8 participants