PHP 7 RC3: How to install missing MySQL PDO

PHP 7 RC3: How to install missing MySQL PDO

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

Stefan Bogdanescu

Founder & Senior Architect

Resolving Missing MySQL PDO in PHP 7 RC3 on Ubuntu

When setting up a development environment for PHP 7 RC3 alongside Nginx on Ubuntu 14.04, you might encounter a specific configuration hurdle: the absence of the MySQL PDO driver. Even after successfully installing the core PHP package from Ondřej Surý's PPA, phpinfo() will reveal that while the PDO extension itself is enabled, the list of drivers remains empty. Without this driver, your application cannot execute database queries, and you lose access to specific constants like PDO::MYSQL_ATTR_DIRECT_QUERY.

The root cause lies in how the PHP 7 packages are structured within the Ubuntu ecosystem at that specific release stage. Unlike PHP 5, where the package naming convention often included the driver name directly (e.g., php5-mysqlnd), PHP 7 on Ubuntu typically separates the core PDO extension from the specific database drivers. In many default repository configurations for PHP 7, there is no pre-built binary package named php7.0-mysql. This absence is not a bug in your installation but rather a result of how the packages were compiled or distributed in that specific snapshot.

To resolve this, you must manually install the missing dependency using the Package Manager. The solution involves locating and installing the appropriate .deb file from Ondřej Surý's repository. Since the standard apt-get install php7.0-mysql command will likely fail with a "package not found" error, you need to construct the full path or locate the specific package name if it differs slightly in the RC build.

In most Ubuntu setups using Ondřej's PPA for PHP 7, the MySQL driver is packaged as php7.0-mysqlnd. You can install it directly with the following command:

sudo apt-get install php7.0-mysqlnd

If this specific package name does not resolve, check the available packages in the PPA by running apt-cache search php7.0 | grep mysql. Once identified, ensure you are targeting the correct architecture (usually amd64 for Vagrant VMs) if downloading from a different source.

After installation, it is critical to verify that PHP recognizes the new driver. Reload your Nginx configuration or restart the web server to ensure any changes in the environment don't conflict with the current process state:

sudo service nginx restart

Then, refresh your phpinfo() page. You should now see the PDO section listing mysqlnd as an enabled driver. This confirms that the connection layer is ready for your application code.

Configuration Considerations and Trade-offs

While installing the driver resolves the immediate connectivity issue, there are architectural nuances to consider when using PHP 7 RC3 in a production or even advanced development context. PHP 7 represents a significant leap in performance over PHP 5, introducing features like scalar type declarations and improved memory management. However, Release Candidate builds are inherently unstable compared to final releases. They may contain bugs that a standard Ubuntu repository package would not expose until the next patch cycle.

Furthermore, relying on RC versions for production environments is generally discouraged unless you have the ability to rebuild packages from source with specific security patches applied. The Ondřej Surý PPA often provides more up-to-date builds than the default Ubuntu repositories, but these packages are compiled against the specific libraries available at the time of release (Ubuntu 14.04 in this case). As Ubuntu 14.04 reached end-of-life long ago, using it with PHP 7 RC3 introduces security risks that modern versions of Ubuntu and PHP mitigate automatically.

If you require access to legacy constants like PDO::MYSQL_ATTR_DIRECT_QUERY, note that these are often deprecated or removed in favor of newer PDO attribute definitions in later PHP versions. Your application logic should be refactored to use standard connection options rather than relying on RC-specific constants, ensuring better long-term compatibility.

Finally, if you are building a Laravel-based application (often associated with laravelcompany.com), ensure that your .env file configuration matches the newly installed driver capabilities. Misconfigured PDO attributes can lead to silent failures or security vulnerabilities, especially when mixing legacy connection strings with modern PHP expectations. Always validate your database connectivity after installing new extensions before deploying code that relies on complex query structures.

Our network