PHP在服务器上不起作用

PHP在服务器上不起作用

本文介绍了PHP在服务器上不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我明天购买了托管服务,从昨天开始,我一直在尝试解决问题.问题是PHP无法在该服务器上正常工作我不知道首先出了什么问题我使用此代码连接到数据库

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";
  }

?>

如果我检查源代码是否也为空白,则使用ftp将其上传到服务器时会显示空白页所以我添加了此内容以检查错误

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

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

然后我收到此错误

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

搜索后,发现没有在PHP.ini中启用mysql和mysqli扩展,因此我请求托管服务提供商启用它(尚未回复)

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)

之后,我使用此简单代码检查PHP是否已启用

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>

但是它只显示Hello Word,而不显示phpinfo

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

推荐答案

您需要通过删除;

extension=php_mysqli.so

这篇关于PHP在服务器上不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-24 09:44