1

Here is the details you must know to understand my question clearly.

Steps : 1) I installed Apache https://www.apachelounge.com/download/* from here and installed and kept it in 'C:' drive on my PC.

2 Installed PHP http://php.net/downloads.php ( Safe Thread ) from here which i used for Apache.

3) Installed mysql from which i am using mysql workbench now.

4) After installing I tried to connect to mysql from PHP using the following code :

#file Name : include.php        
<?php
$hostname = "localhost";
$user = "root";
$pass = "root";
$dbName = "TEST_DB";
$conn = mysqli_connect($hostname, $user, $pass, $dbName);

if(!$conn) {
     die(mysqli_error($conn));
}
else {
     die("SUCCES!!!");
}
?>

Then i included " include.php" in my other php file where the html code is written :

#File Name : index.php
<?php
    include '.\include.php'

?>
<!--Starting of the HTML-->


<!--language of the webpage-->
<html lang="en">

<!--Starting of the head-->
<head>
.....//mycodes....
</head>
</html>

Now i am getting this error while loading this in my browser :

" Fatal error: Uncaught Error: Call to undefined function mysqli_connect() in C:\Apache24\htdocs\include.php:6 Stack trace: #0 C:\Apache24\htdocs\index.php(2): include() #1 {main} thrown in C:\Apache24\htdocs\include.php on line 6 "

Apache, PHP , Mysql is working fine indivisually.

Can you help me out of this situation ?

EDIT

I have uncommented all extension :

extension_dir='c:\php\ext' 
extension=bz2; 
extension=curl 
extension=fileinfo 
extension=gd2 
extension=gettext 
extension=gmp 
extension=intl 
extension=imap 
extension=interbase 
extension=ldap 
extension=mbstring 
extension=exif ; Must be after mbstring as it depends on it 
extension=mysqli; 
extension=oci8_12c ; Use with Oracle Database 12c Instant Client 
extension=odbc 
extension=openssl 
extension=pdo_firebird 
extension=pdo_mysql 
extension=pdo_oci 
extension=pdo_odbc 
extension=pdo_pgsql 
extension=pdo_sqlite 
extension=pgsql 
extension=shmop; 
RiggsFolly
  • 93,638
  • 21
  • 103
  • 149
  • do you have modify your php.ini to activate mysql extension ? – Inazo Aug 22 '18 at 08:31
  • Edit the `php.ini` file under `apache24/bin/php.ini` then look for `extension=php_mysqli.dll` make sure it is not commented out i.e. there is no `;` at the front of that line – RiggsFolly Aug 22 '18 at 08:33
  • i think in apache24 does not have any php,ini. it is present in PHP file – Subham Patra Aug 22 '18 at 08:40
  • create a little script that just does `` on the first page of the output look for the parameter `Loaded Configuration File` that will tell you where Apache is loading the `php.ini` file from – RiggsFolly Aug 22 '18 at 08:45
  • Not sure if something has changed in the `php.ini` file, but extension parameters normally look like this `extension=php_bz2.dll` and not `extension=bz2` How did you create that set of extensions you are showing us. Have you checked the apache and php error logs, maybe you have bigger problems than you think – RiggsFolly Aug 22 '18 at 08:53

0 Answers0