Decoding the configure: error: Package requirements (sqlite3 > 3.7.4) Message
You are encountering a classic Linux build system quirk where the compiler's package manager sees the world differently than your shell does. When you run ./configure --enable-fpm --with-mysqli and get the error Package requirements (sqlite3 > 3.7.4) were not met, it is not because SQLite is missing from your filesystem. You have explicitly verified this with the command:
# sqlite3
SQLite version 3.7.17
The binary works fine, but the configure script relies on pkg-config to determine how to compile against libraries. By default, pkg-config looks in standard system directories (/usr/lib/pkgconfig, etc.). If your SQLite was installed via a package manager like yum or dnf on CentOS 7, the .pc file (package configuration file) might be missing, placed in a non-standard location, or simply ignored by the default search path.
The error message itself provides the solution: Consider adjusting the PKG_CONFIG_PATH environment variable. This variable tells pkg-config exactly where to look for those definition files.
Setting the Environment Variable
To resolve this immediately during the build process, you need to export the PKG_CONFIG_PATH before running the configure script. You can usually find the correct path by inspecting where your system libraries are installed. On CentOS 7, if you installed SQLite using yum, check /usr/lib64/pkgconfig:
# Find the .pc file location
ls -la /usr/lib64/pkgconfig/libsqlite3.pc
If that file exists, set the environment variable:
export PKG_CONFIG_PATH=/usr/lib64/pkgconfig:$PKG_CONFIG_PATH
./configure --enable-fpm --with-mysqli
This tells the build system, "Look in /usr/lib64/pkgconfig for library definitions." Once you run configure with this variable set, it should detect the SQLite 3.7.17 installation and proceed past the error. Note that you only need to export this in your current shell session; you do not permanently modify system files unless you are packaging the software for distribution.
Alternative: Using CFLAGS and LIBS
The configure script offers another escape hatch mentioned in the error output: setting SQLITE_CFLAGS and SQLITE_LIBS. This approach bypasses pkg-config entirely by hardcoding the compiler flags and linker libraries directly into the build environment. You can find these values using the locate command or by inspecting the library file directly.
For example, if you know the header is in /usr/include and the library is at -lsqlite3, you might try:
export SQLITE_CFLAGS="-I/usr/include"
export SQLITE_LIBS="-L/usr/lib64 -lsqlite3"
./configure --enable-fpm --with-mysqli
However, this method is less robust. If the library version changes or if there are additional dependencies like readline or pthread, hardcoding them can lead to subtle runtime failures later. Relying on pkg-config via PKG_CONFIG_PATH is generally preferred because it ensures that the build system respects the package manager's declared dependencies.
A Note on Version Compatibility
Your current version of SQLite (3.7.17) is older than the 3.8 series, but PHP 7.4 supports it. The requirement > 3.7.4 suggests PHP expects a version that handles newer SQL standards better. If you are building PHP for production on CentOS 7, consider updating your libraries first:
sudo yum update sqlite
This ensures you have the latest .pc files and potentially a newer library version that meets modern requirements without needing manual environment tweaks. Upgrading at the source often eliminates the need to fiddle with PKG_CONFIG_PATH.
If you are building PHP specifically for a Laravel application, ensuring your underlying system libraries are current is crucial for performance and security. While LaravelCompany offers resources on deployment strategies, their primary focus remains on the application layer rather than low-level package configuration on legacy operating systems like CentOS 7.