0

I bought hosting service tomorrow and from yesterday I am trying to solve problems. Problem is that PHP is not working on this server I don't know what is wrong first I used this code to connect to database

<?php
 Create connection
$con=mysqli_connect("localhost","user","pass","database");

// Check connection
if (mysqli_connect_errno())
  {
  echo "Failed to connect to MySQL: " . mysqli_connect_error();
  }
  else {
  echo "Connected";
  }

?>  

It show me blank page when I upload it to server using ftp if I check source code it's also blank So I added this to check the error

ini_set('display_errors',1); 
 error_reporting(E_ALL);

then I got this error

Fatal error: Call to undefined function mysqli_connect() in /home/vidupda1/public_html/cont.php on line 6

After searching it was come to the point that mysql and mysqli extensions are not enabled in PHP.ini so I requested my hosting service provider to enable it (not replied yet)

After that I used this simple code to check if PHP is enabled or not

<html>
<title>Test</title>
    <body>
        <?php
        echo "Hello World";
phpinfo();
        ?>
    </body>
</html>

but It shows just Hello Word but not the phpinfo

So Tell me what is the acutal problem and would my problem solved after they enable these extensions ?

;extension=php_mysql.so
;extension=php_mysqli.so
;extension=php_pdo_mysql.so
user3462619
  • 31
  • 1
  • 1
  • 2
  • yes, enable the extension solves the problem – Tamil Selvan C Mar 26 '14 at 05:06
  • 1
    PHP is working as you got your output. `phpinfo` may be disabled at your host. – JBES Mar 26 '14 at 05:08
  • Thanks so I have to wait for them to enable it – user3462619 Mar 26 '14 at 05:09
  • 1
    Why downvotes, This could be confusing for someone which not deployed php applications to shared hosts, So he have no idea about why phpinfo() not working. Still he contacted first hosting provider to on extensions instead of asking SO first. I myself never faced phpinfo function block even on some of Shared hosts. – kuldeep.kamboj Mar 26 '14 at 07:22

4 Answers4

2

You need to enable mysqli extension by removing the ;

extension=php_mysqli.so
Felix
  • 37,892
  • 8
  • 43
  • 55
1

I am not sure, but I believe you cannot run phpinfo() on commercial websites due to security settings. The fact that you can echo out 'Hello World' means that PHP is working. Then I believe you should wait for your host reply.

Best regards Shahram

Sh.Sab
  • 11
  • 1
0

just remove the ";" and restart the apache service

PravinS
  • 2,640
  • 3
  • 21
  • 25
0

If they disabled the mysql functions, it's also possible and likely they disabled phpInfo() as well. If you succeed in getting those changes, then your code should work fine.

peterx
  • 196
  • 3