How to resolve Issue: Permission Denied When Saving alt_php.ini in CageFS

June 13, 2025 / Command Line

In this article, you will learn how to resolve the Issue: Permission Denied When Saving alt_php.ini in CageFS.

When attempting to reset, add, or configure PHP extensions using PHP Selector on a CloudLinux server, you may encounter the following error:
Unable to save data to /var/cagefs/…/cl.php.d/alt_php.ini ([Errno 13] Permission denied: ‘/var/cagefs/…/clseltmp_XXX’)

Reason:
This issue typically occurs due to incorrect ownership or permissions within the user’s CageFS directory.

Solution:

  1. Find the CageFS Path for the User
    Run the following command to locate the CageFS directory for the affected user (replace exampleuser with the actual username):

    find /var/cagefs -user exampleuser
  2. Reset Ownership
    Use the output from the previous step to reset ownership of the cl.php.d directory:

    chown -R exampleuser /var/cagefs/XXX/cl.php.d
  1. Update and Remount CageFS
    After correcting ownership, update CageFS and remount it for the user:

    cagefsctl --force-update
    cagefsctl -m exampleuser
  1. Fix Directory Permissions
    Ensure that all directories within the cl.php.d path have the correct permissions:

    find /var/cagefs/XXX/cl.php.d -type d ! -perm 755 -exec chmod 755 {} \;

This resolves the permission denied error in PHP Selector. Updating and remounting CageFS helps apply the changes effectively.

Still managing user environments? Learn How to enable or disable CageFS for users in CloudLinux

Spread the love