Fix Missing PHP Extensions and File Permissions in CodeCanyon Scripts

by Fahim

CodeCanyon web installers love stopping you dead on step two with a wall of red crosses. You unzip the script, navigate to /install, and suddenly you’re blocked because ext-bcmath isn’t installed and half your directories are flagged as unwritable.

I ran into this exact headache last week setting up a multi-tenant booking script from Envato. The wizard demanded seven distinct PHP modules and refused to generate its own configuration file. Here’s how to figure out what’s actually missing, get the modules installed cleanly on a VPS or shared hosting, and dial in the right folder permissions without blindly resorting to chmod 777.

Linux terminal output showing directory ownership and PHP extension checks for a web script
Linux terminal output showing directory ownership and PHP extension checks for a web script

The Pre-Installation Checklist Error

Most commercial PHP scripts—whether built on Laravel, CodeIgniter, or older procedural code—run an environmental check right at the start. Behind the scenes, they run basic PHP checks like extension_loaded() for modules and is_writable() for folders.

When an extension is missing, the installer halts. Don’t try bypassing this by commenting out checks in the installer code; you’ll just trigger silent runtime crashes later. Missing fileinfo breaks file uploads, and missing bcmath corrupts payment or invoice calculations down the road.

Permission issues are just as frustrating. The installer needs to write your database credentials to .env and dump compiled views into storage/. If your web server process can’t write to those paths, the installer will either spin forever or dump a generic 500 error on step three.

Find Missing Extensions: CLI vs Web SAPI

The biggest trap here is running php -m in SSH, seeing the extension listed, and assuming everything is fine. CLI PHP and PHP-FPM use entirely separate configuration files and often run completely different PHP versions.

Check what your CLI sees first:

php -m | grep -E "(bcmath|ctype|curl|dom|fileinfo|gd|intl|json|mbstring|openssl|pcre|pdo_mysql|tokenizer|xml|zip)"

Now verify what your web server is actually using. Drop a quick diagnostic file into your public web root:

echo "" > /var/www/html/test-php.php

Open test-php.php in your browser and check two critical lines:

  • Loaded Configuration File: Confirms which php.ini PHP-FPM or Apache is actually reading.
  • Registered PHP Streams / Core Extensions: Shows what modules are loaded in memory for web requests.

Delete test-php.php the moment you’re done. You don’t want your server environment details sitting out in the open.

Install Missing Extensions on Ubuntu and Debian (VPS)

On an unmanaged VPS running Ubuntu 22.04 or 24.04 with Nginx and PHP-FPM, you have to install these modules through your system package manager. Most CodeCanyon scripts target PHP 8.1 or 8.2.

Check your active PHP version:

php -v

Assuming you’re on PHP 8.2, this command covers the standard stack required by 95% of Envato scripts:

sudo apt update
sudo apt install -y  php8.2-bcmath  php8.2-curl  php8.2-gd  php8.2-intl  php8.2-mbstring  php8.2-mysql  php8.2-xml  php8.2-zip  php8.2-fileinfo

Once the packages finish installing, restart PHP-FPM and your web server. If you forget this step, the web wizard will keep showing red crosses:

sudo systemctl restart php8.2-fpm
sudo systemctl restart nginx

If you’re running Apache with mod_php instead, reload Apache directly:

sudo systemctl restart apache2

If your script asks for less common modules like imagick, gmp, or sodium, check the PHP extensions documentation for package naming specifics.

Enable Extensions in cPanel and Hostinger hPanel

If you’re on shared hosting, you won’t have root SSH access to run apt. You’ll need to toggle extensions through your host’s PHP management panel.

Enabling Modules in cPanel

  1. Log into cPanel and search for Select PHP Version under the Software tab.
  2. Make sure your domain isn’t locked to the native system version; pick an active version like 8.1 or 8.2.
  3. Switch to the Extensions tab.
  4. Check the boxes for bcmath, fileinfo, gd, intl, pdo_mysql, and zip.
  5. Changes take effect immediately without a server reload.

Enabling Modules in Hostinger hPanel

  1. Go to your dashboard and click Advanced > PHP Configuration.
  2. Click the PHP Extensions tab.
  3. Search for missing modules like intl or fileinfo.
  4. Toggle them on and hit Save at the bottom.

While you’re tweaking settings, remember that execution limits matter just as much as modules. If the installer hangs during archive extraction or database seeding, take a look at our guide on how to install Envato themes and import demo data without timeouts to bump your memory and execution caps.

Directory Permissions: Why 777 Is the Wrong Solution

Too many CodeCanyon PDF manuals tell you to run chmod -R 777 storage bootstrap/cache. Don’t do it. Setting 777 makes files world-readable, world-writable, and executable by any process on your server. If the script has a single file upload vulnerability, an attacker can upload a web shell and execute it instantly.

The proper approach is matching Linux file ownership to your web server user, then using standard permissions (755 for directories, 644 for files).

Find out which user runs your web server process:

ps aux | grep -E '(apache|nginx|php-fpm)' | awk '{print $1}' | sort -u

On Ubuntu and Debian, this is almost always www-data. On CentOS, RHEL, or AlmaLinux, look for nginx or apache.

Set Ownership and Directory Permissions

Assuming your project lives in /var/www/my-codecanyon-app, here’s how to set clean baseline ownership and permissions from the terminal.

First, give your system user and the web server group shared ownership:

sudo chown -R $USER:www-data /var/www/my-codecanyon-app

Set base permissions across the entire project:

find /var/www/my-codecanyon-app -type d -exec chmod 755 {} ;
find /var/www/my-codecanyon-app -type f -exec chmod 644 {} ;

Now grant group write access only to the directories the application actually needs to write to:

cd /var/www/my-codecanyon-app
sudo chmod -R 775 storage bootstrap/cache public/uploads

Make sure the installer can write its database settings to the configuration file during setup:

sudo touch .env
sudo chown $USER:www-data .env
sudo chmod 664 .env

Once installation finishes and your database is configured, lock .env down so it’s read-only for the web group:

sudo chmod 640 .env

If you need a refresher on octal modes and write bits, check out the Linux chmod man page.

Fixing File Upload Size Mismatches

Once the extensions and folder permissions are sorted, installers often choke on upload limits. If your script handles ZIP imports, license verification bundles, or brand logos during onboarding, default 2MB limits will crash it.

Bump these directives in your active php.ini:

upload_max_filesize = 64M
post_max_size = 64M
memory_limit = 256M
max_execution_time = 300

If you’re on Nginx, make sure your server block allows the same request body size:

server { listen 80; server_name app.example.com; client_max_body_size 64M; # ... remaining configuration
}

If you’re seeing HTTP 413 errors when uploading packages, check out our walkthrough on how to fix 413 Request Entity Too Large in WordPress and Nginx to sort out request sizing.

What I Ran: Fixing a Broken Laravel Script Installer

Here’s the exact terminal sequence I ran last week on a fresh DigitalOcean droplet. The Envato wizard showed red flags on fileinfo, intl, and failed on bootstrap/cache permissions.

This cleared every check in under a minute:

# 1. Install missing libraries
sudo apt install -y php8.2-intl php8.2-fileinfo # 2. Restart FastCGI
sudo systemctl restart php8.2-fpm # 3. Fix ownership
sudo chown -R www-data:www-data /var/www/script/storage
sudo chown -R www-data:www-data /var/www/script/bootstrap/cache # 4. Apply write permissions to target directories
sudo chmod -R 775 /var/www/script/storage
sudo chmod -R 775 /var/www/script/bootstrap/cache # 5. Fix .env read-write access
sudo chown www-data:www-data /var/www/script/.env
sudo chmod 664 /var/www/script/.env

I refreshed the browser, hit green checkmarks across every single requirement, and the script finished running its migrations on the very next click.

Debugging Persistent Permission Denied Errors

If you ran chown and chmod but the web installer still claims folders are unwritable, check these three common tripwires:

1. SELinux Enforcing Mode

On RHEL, Rocky Linux, or AlmaLinux, SELinux blocks PHP from writing to files even if Unix permissions are wide open. Check your status:

getenforce

If it returns Enforcing, restore the proper security context on your writable directories:

sudo semanage fcontext -a -t httpd_sys_rw_content_t "/var/www/html/storage(/.*)?"
sudo restorecon -R /var/www/html/storage

2. PHP-FPM Pool User Discrepancy

Take a look at your PHP-FPM pool config. Open /etc/php/8.2/fpm/pool.d/www.conf and see what user it runs under:

user = www-data
group = www-data
listen.owner = www-data
listen.group = www-data

If your pool runs as a user different from your folder’s group owner, PHP-FPM won’t be able to write anything. Update the pool config or sync your folder group to match.

3. Root-Owned Log and Cache Files

If you ran Composer or Artisan commands with sudo, files like storage/logs/laravel.log might now be owned by root. Check with:

ls -la storage/logs/

If you see root root, hand ownership back to your web server user:

sudo chown -R www-data:www-data storage/

Frequently Asked Questions

Why does the installer say PHP 8.1 is required when I have PHP 8.2?

A lot of older CodeCanyon scripts have lazy version checks that look for an exact string match (like 8.1.*) instead of evaluating >= 8.1. Another possibility: your CLI is running PHP 8.2 while your web server pool is still bound to 8.0. Check your browser phpinfo() file to be certain.

Can I leave folder permissions at 777 during local development?

In a local Docker setup or local VM, 777 avoids annoying permission clashes between your IDE user and the container user. Just don’t let it become a habit—make sure those 777 commands never end up inside your deployment scripts or production servers.

What should I do if the installer fails with a 500 error after submitting the database form?

Check your error logs immediately. For Nginx, look in /var/log/nginx/error.log. For PHP-FPM, check /var/log/php8.2-fpm.log. In most cases, either the installer timed out because the pdo_mysql extension wasn’t installed, or it failed while trying to write credentials into .env.

How do I fix missing extensions on shared cPanel without CloudLinux PHP Selector?

If your host doesn’t offer CloudLinux PHP Selector, check for MultiPHP INI Editor in cPanel. Some hosts allow you to enable extensions directly by adding extension=intl.so to your custom php.ini. If that’s blocked by the server policy, you’ll need to submit a ticket asking support to enable it on your account.

Next Steps

Once you pass the setup checks and finish the database import, test your routing. Many scripts use front-controller routing that throws 404s as soon as you click off the dashboard. Take a look at our guide on how to fix 404 route errors for CodeCanyon PHP scripts on Nginx to get your rewrite rules configured properly.

all_in_one_marketing_tool