win10 Apache24+PHP8.0, Apache cannot load php.ini normally.
hdmovie
hdmovie 2021-12-15 11:04:22
0
1
1199

The following configuration has been made in httpd.conf

LoadModule php_module "D:\php\php8apache2_4.dll"
<ifModule php_module>
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
</ifModule>
PHPIniDir "D:/php"

Open the curl, mbstring, gd, openssl modules in php.ini, and use php -S <host> to provide web services, in phpinfo You can see these modules being loaded.

But if Apache is used to provide web services, phpinfo does not show that these modules are loaded.

Use the following code to test. Apache will display "No gd", which means that the gd function is not loaded.

function checkRequirements()
{
    if (extension_loaded('gd')) {
        $gdInfo = gd_info();
        if (!empty($gdInfo['FreeType Support'])) {
            echo "gd成功";
            return 'gd';
        }
    }else{
       echo "没有gd";
    }
 }

checkRequirements();

The situation is the same when php8 is replaced by php7.4.

What is asking for help?

hdmovie
hdmovie

reply all(1)
hdmovie

The reason is found. The extension_dir is not configured correctly in php.ini. The default ext must be changed to an absolute path. Otherwise, Apache will report that the loading is unsuccessful.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template