Skip to content

Make temporary file path dynamic instead of forcing /tmp/ (shared hosting compatibility) #183

@DabrosDKOS

Description

@DabrosDKOS

Hi! 👋
I’ve noticed that in the file
src/Actions/UpdateOrCreateAccount.php
specifically here:
https://github.com/inovector/mixpost/blob/main/src/Actions/UpdateOrCreateAccount.php#L43

the package assumes that the system temporary directory is /tmp/.

On many shared hosting environments (e.g., cPanel, DirectAdmin, dHosting, etc.), access to /tmp/ is restricted by open_basedir.
These environments often provide a custom, user-specific temporary directory such as:

/home/username/.tmp/
/home/username/tmp/

Because the path is hardcoded to /tmp/, Mixpost fails with:

file_put_contents(): open_basedir restriction in effect

💡 Proposal

Would it be possible to make the temporary path dynamic?

For example, use:

sys_get_temp_dir()

or allow setting a custom temp directory via configuration (e.g. an environment variable like MIXPOST_TMP_DIR).

This would greatly improve compatibility with shared-hosting setups where /tmp/ is not writable.

Thanks! 🙌

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions