Apache 2.4 and PHP 8.4 on Windows: Why aren’t curl, ftp, and openssl modules loading?
Several modules are enabled in php.ini:
extension=c:\Apache24\php8\ext\php_bz2.dll
;extension=c:\Apache24\php8\ext\php_curl.dll ****this doesn’t work either
extension=curl
;extension=c:\Apache24\php8\ext\php_ftp.dll ****this doesn’t work either
extension=ftp
extension=c:\Apache24\php8\ext\php_fileinfo.dll
extension=c:\Apache24\php8\ext\php_gd.dll
extension=c:\Apache24\php8\ext\php_gettext.dll
extension=c:\Apache24\php8\ext\php_mbstring.dll
extension=openssl
;extension=c:\Apache24\php8\ext\php_openssl.dll ****this doesn’t work either
extension=c:\Apache24\php8\ext\php_pdo_mysql.dll
The curl, ftp, and openssl modules are not loading on the web server (phpinfo() doesn’t show them), but they work when running from command line (php -i shows their loading).
There are warnings in the Apache logs:
PHP Warning: PHP Startup: Unable to load dynamic library ‘C:\Apache24\php8\ext\php_curl.dll’ (tried: C:\Apache24\php8\ext\php_curl.dll (The specified module could not be found), C:\Apache24\php\ext\php_C:\Apache24\php8\ext\php_curl.dll.dll (The specified module could not be found)) in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library ‘c:\Apache24\php8\ext\php_ftp.dll’ (tried: c:\Apache24\php8\ext\php_ftp.dll (The specified module could not be found), C:\Apache24\php\ext\php_c:\Apache24\php8\ext\php_ftp.dll.dll (The specified module could not be found)) in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library ‘c:\Apache24\php8\ext\php_openssl.dll’ (tried: c:\Apache24\php8\ext\php_openssl.dll (The specified module could not be found), C:\Apache24\php\ext\php_c:\Apache24\php8\ext\php_openssl.dll.dll (The specified module could not be found)) in Unknown on line 0
All standard recommendations have already been tried. What else can be attempted to resolve the issue with loading curl, ftp, and openssl modules in Apache with PHP 8.4 on Windows?
The main issue with loading curl, ftp, and openssl modules in Apache 2.4 with PHP 8.4 on Windows is related to path conflicts and possibly module architecture mismatches. Errors in the logs show strange path concatenation, indicating incorrect extension_dir configuration or path issues in php.ini.
Table of Contents
- Main Causes of the Problem
- Configuration Diagnostics
- Solutions to the Problem
- Additional Checks
- Alternative Approaches
Main Causes of the Problem
Based on Apache log errors, there are several key issues:
Incorrect extension_dir Configuration
The error C:\Apache24\php\ext\\php_C:\Apache24\php8\ext\php_curl.dll.dll shows that strange path merging is occurring. This happens when:
- extension_dir in php.ini is configured incorrectly
- There are multiple php.ini files
- Apache is looking for modules in the wrong directory
Module Architecture Mismatch
PHP 8.4 has two build versions:
- Thread Safe (TS) - for Apache with modular PHP
- Non-Thread Safe (NTS) - for FastCGI
If you try to load a module built for a different architecture, you’ll get a dynamic library loading error.
Missing Dependencies
The curl and openssl modules require certain DLLs in the system PATH:
- libcurl.dll for the curl module
- libeay32.dll or libssl.dll for the openssl module
- ssleay32.dll for older versions
Configuration Diagnostics
Checking php.ini
Ensure that your php.ini has the following parameters configured correctly:
extension_dir = "C:\Apache24\php8\ext"
Important: Verify that the extension_dir path exactly matches your module location and uses double backslashes (\\) or single backslashes (\).
Finding All php.ini Files
On Windows, there may be multiple php.ini files:
C:\Apache24\php8\php.ini- main fileC:\Windows\php.ini- global fileC:\php\php.ini- alternative installation
Use the following command in the command prompt:
where php.ini
Solutions to the Problem
1. Fixing Paths in php.ini
Replace current settings with explicit paths:
extension_dir = "C:\Apache24\php8\ext"
extension=php_curl.dll
extension=php_ftp.dll
extension=php_openssl.dll
Why this is important: Explicit paths help avoid confusion with relative paths and path concatenation.
2. Verifying Module Architecture
Ensure all modules have the same architecture as your PHP build:
-
Check PHP architecture:
cmdphp -i | findstr "Thread" -
Compare with module architecture. Files should contain in their names:
- php8ts.dll for Thread Safe
- php8nts.dll for Non-Thread Safe
3. Adding Dependencies to PATH
Add the following directories to the system PATH variable:
C:\Apache24\php8C:\Apache24\php8\ext
This will ensure access to the required DLL files.
4. Checking Access Rights
Ensure that:
- The user running Apache (usually SYSTEM) has read permissions for module files
- Files are not blocked by antivirus software
- Files are not being used by other processes
Additional Checks
Validating Apache Configuration
Check your Apache configuration for duplicate PHP settings:
LoadModule php_module "C:/Apache24/php8/php8apache2_4.dll"
Make sure the path to the PHP module is correct.
Using a Test Script
Create a test.php file with the following content:
<?php
phpinfo();
?>
Check which php.ini is being used:
<?php
echo php_ini_loaded_file();
?>
Manual Module Loading
Try loading modules manually through Apache configuration:
<IfModule php_module>
LoadFile "C:/Apache24/php8/php8ts.dll"
LoadFile "C:/Apache24/php8/ext/php_curl.dll"
LoadFile "C:/Apache24/php8/ext/php_openssl.dll"
</IfModule>
Alternative Approaches
Reinstalling PHP
If nothing helps, perform a clean PHP reinstall:
- Completely remove the current PHP version
- Download a fresh version from the official PHP website
- Ensure the architecture matches Apache
- Install with correct paths
Using XAMPP
Consider using XAMPP, as mentioned in Wikipedia, which comes with pre-configured components including OpenSSL and other modules.
Upgrading to PHP 8.3 or Downgrading
If the issue isn’t resolved, consider temporarily using PHP 8.3, for which modules are more stable.
Sources
- XAMPP - Wikipedia - Information about pre-configured components including OpenSSL
- PHP Startup: Unable to load dynamic library - Local Community - Discussion of dynamic library loading issues
- phpinfo() not working in php setup - Web Site Development - Issues with phpinfo() and Apache reinstall
Conclusion
The issue with loading curl, ftp, and openssl modules in Apache 2.4 with PHP 8.4 on Windows is typically resolved by the following steps:
- Check and fix paths in php.ini, using explicit paths to modules
- Ensure architecture match between PHP and modules (Thread Safe/Non-Thread Safe)
- Add required DLLs to PATH system
- Check for multiple php.ini files and use the correct one
- Reinstall PHP if necessary, ensuring version compatibility
If modules work from the command line but not in Apache, the issue is definitely related to the web server configuration or access rights. Start by checking paths and architecture - this resolves 90% of similar problems.