WARNING: Module ini file doesn't exist under /etc/php/7.0/mods-available

WARNING: Module ini file doesn't exist under /etc/php/7.0/mods-available

  1. Blog
  2. 15 November 2026
  3. 3 min read

Stefan Bogdanescu

Founder & Senior Architect

WARNING: Module ini file doesn't exist under /etc/php/7.0/mods-available

You recently uninstalled PHP 7 and its associated modules from Ubuntu, likely to troubleshoot a dependency conflict or free up disk space. When you attempt to reinstall those specific extensions, the package manager reports that the module is being installed but fails to activate it because of a missing configuration file in /etc/php/7.0/mods-available. The error message explicitly states: WARNING: Module [module name] ini file doesn't exist under /etc/php/7.0/mods-available.

This behavior occurs because Ubuntu's packaging system manages PHP extensions via symlinks between two directories: /etc/php/7.0/mods-available, where the actual .ini configuration files reside, and /etc/php/7.0/mods-enabled, which contains the active symlinks pointing to those files. When you perform a full removal of the php7.x-common or php7.x-fpm packages, the package manager often removes the contents of /etc/php/7.0/mods-available as well, treating them as part of the "common" configuration that was wiped.

However, the symlink structure in /etc/php/7.0/mods-enabled might remain partially intact or be recreated by the re-installation script before the actual source files are restored. The dpkg logic checks for the existence of the .ini file in the "available" directory to confirm that a valid configuration exists to link. If the directory is empty or missing, it throws this warning and refuses to create the symlink, leaving the module technically installed but inactive.

To resolve this, you must manually recreate the empty source files before attempting to enable the modules again. You do not need to reinstall every single package; simply ensuring the "available" directory contains its .ini stubs is sufficient.

Run the following command to verify if the directory exists and what it contains:

ls -la /etc/php/7.0/mods-available/

If the directory is missing or empty, you can force the creation of the necessary files using dpkg-reconfigure on the specific extension packages or by reinstalling just the common package without wiping existing configurations. Alternatively, you can manually create a dummy file for each module if you know the exact name:

touch /etc/php/7.0/mods-available/intl.ini
touch /etc/php/7.0/mods-available/json.ini
# Repeat for all other modules causing the error

Once these files exist, even if they are empty or contain minimal defaults, the package manager will recognize that the configuration source is present. You can then enable the modules using a2enmod or the specific PHP command:

phpenmod intl json mbstring

If you prefer a cleaner approach without manually touching every single file, reinstalling the php7.0-common package specifically often restores the default content of /etc/php/7.0/mods-available without necessarily breaking your application's custom settings in /etc/php/7.0/apache2/conf.d.

sudo apt-get install --reinstall php7.0-common

After this, retry enabling your specific extensions. The warning should disappear, and the modules will function correctly. This distinction between mods-available (the repository of all possible configurations) and mods-enabled (the active subset) is a common source of confusion during system migrations or clean installs on Debian-based distributions like Ubuntu.

For developers maintaining legacy PHP 7 applications, understanding this directory structure prevents unnecessary reinstallation of heavy extension packages when only the configuration files are missing. If you are managing multiple servers and need to replicate this state, remember that mods-available is often generated from the package content, so reinstalling the common base package is usually the most robust solution.

If you encounter similar issues with specific Laravel projects or complex PHP stacks, ensuring your php.ini references match the paths in these directories is critical. For advanced PHP hosting needs or enterprise-grade deployments, LaravelCompany offers managed environments where such low-level file system inconsistencies are handled automatically, allowing you to focus on application logic rather than package manager quirks.

Our network