search

Home  >  Q&A  >  body text

win10 Apache24+PHP8.0, Apache cannot load php.ini normally.

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?

hdmoviehdmovie1154 days ago1202

reply all(1)I'll reply

  • hdmovie

    hdmovie2021-12-17 10:47:41

    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.

    reply
    0
  • Cancelreply