Modify a cPanel User's PHP Upload Path

This article discusses how to modify a cPanel user's PHP upload path (as WHM administrator). This guide assumes root-equivalent access to a cPanel VPS or cPanel dedicated server.

About PHP Upload Path

PHP uses a system variable to determine the upload path. By default, this is configured as /tmp. The standard workflow uploads a file to /tmp, and then moves it into the site's upload path. This article provides the procedure to change the default upload path.

How to Modify a cPanel User's PHP Upload Path

There procedure to modify a cPanel user's PHP upload path is contingent upon whether the domain uses the PHP-FPM PHP handler or not. We will discuss both processes below.

  1. Modify PHP Upload Path for Domain Using PHP

    1. Log in to the user's cPanel account.
    2. Open the "MultiPHP INI Editor" app in the "Software" section.
    3. Click the "Editor Mode" tab.
    4. From the "Select the home directory or a domain’s document root to open the corresponding PHP configuration" dropdown menu, select the domain to change the upload path.
    5. Add the following line in the textbox.
      sys_temp_dir = "/path/to/new/upload/folder"
      Please note that "/path/to/new/upload/folder" must be replaced with the absolute path to the new upload location.
    6. Click the "Save" button.
  2. Modify PHP Upload Path for Domain Using PHP-FPM Handler

    1. Access the server's command line as the 'root' user via SSH or "Terminal" in WHM.
    2. Open the /var/cpanel/userdata/$cpuser/domain.tld.php-fpm.yaml file in your preferred text editor.
      Please note that "$cpuser" and "domain.tld" must be replaced with the cPanel username and the domain to change the upload location.
    3. Add the following line to the file on a new line after the _is_present: 1 line.
      php_admin_value_upload_tmp_dir: { name: 'php_admin_value[upload_tmp_dir]', value: "/path/to/new/upload/folder" }
      Please note that "/path/to/new/upload/folder" must be replaced with the full path to the new upload folder.
    4. Save the changes and exit the text editor.
    5. Rebuild the PHP-FPM configuration.
      /scripts/php_fpm_config --rebuild

Conclusion

You now know how to modify a cPanel user's PHP upload path.

  • php, php-fpm, multiphp manager
  • 1 Utilizadores acharam útil
Esta resposta foi útil?

Artigos Relacionados

Disable Network Manager on CentOS 7

This article will provide the steps to disable Network Manager in CentOS 7. Network Manager is...

Disable Network Manager on CentOS 6

This article will provide the steps to disable Network Manager in CentOS 6. Network Manager is...

How to Find the IP of cPanel/WHM Server

This tutorial is designed to troubleshoot and diagnose issues with cPanel license errors. Find...

Uninstall WHMXtra on cPanel Server

This article provides a quick and direct guide for uninstalling the WHMXtra plugin from a...

How to Customize cPanel Installation

This article provides a guide for customizing a cPanel server installation, using the...