简体   繁体   English

PHP脚本不适用于Plesk

[英]PHP Scripts not working with Plesk

It's the first time that I've worked with Plesk. 这是我第一次与Plesk合作。 Before using Plesk, this website and scripts were all fully functional all of the PHP was working without issue although once it was moved to a different host using Plesk, most of the PHP is now showing up as plain text. 在使用Plesk之前,此网站和脚本都具有完整的功能,所有PHP都可以正常使用,尽管一旦使用Plesk将其移至其他主机后,大多数PHP现在都以纯文本形式显示。 Some of the includes are working, but a lot of the short MySQLi commands do not work, such as; 其中的一些包括有效,但许多简短的MySQLi命令无效,例如;

$conn->query
$result2->fetch_row()
$result->num_rows

Also, when I try and perform a very simple test, such as; 另外,当我尝试执行非常简单的测试时,例如;

$test = 'hello';
echo $test; 

I get nothing returning? 我什么也没回来? Here is an example of one of the scripts I am using and how it shows up on the website... 这是我正在使用的脚本之一及其在网站上的显示方式的示例...

<?
if($show == 'All'){
        $sql = mysqli_query($conn, "SELECT * FROM `xWKaiNXU_news` WHERE `news_public` = '1' ORDER BY `news_date` DESC LIMIT 100");
        } else {
        if($show == 'EVENT'){
                $sql = mysqli_query($conn, "SELECT * FROM `xWKaiNXU_news` WHERE (`news_type` = 'EVENT' OR `news_type` = 'PDF') AND `news_public` = '1' ORDER BY `news_date` DESC LIMIT 100");   
            } else {
        $sql = mysqli_query($conn, "SELECT * FROM `xWKaiNXU_news` WHERE `news_type` = '$show' AND `news_public` = '1' ORDER BY `news_date` DESC LIMIT 100");    
            }
        }
          $result = $sql;
echo $test;
          if (mysqli_num_rows($result) > 0) {

              while($row = mysqli_fetch_assoc($result)) {
                    $news_id = $row['news_id'];
                    $news_type = $row['news_type'];
                    $news_title = $row['news_title'];
                    $news_tagline = $row['news_tagline'];
                    $news_date = date('dS F Y', strtotime($row['news_date']));
                    $news_time = date('H:i', strtotime($row['news_date']));
                    $news_image = $row['news_image'];


                    if($news_type == 'PDF'){
                        $news_text = $row['news_text'];
                    ?>
                        <div class="col-md-12">
                      <article class="post">
                        <div class="row" align="center">


                    <?
                    if($news_tagline == 'port'){
                    ?>
                    <hr>
                    <p>From: <h4><? echo $news_date; ?></h4></p>
                    <p><? echo $news_text; ?></p>
                     <object data="<? echo $news_image; ?>" type="application/pdf" width="80%" height="600px">
  <p>Alternative link - <a href="<? echo $news_image; ?>">PDF Viewer</a></p>
</object>

                    <?  
                    } else {
                    ?>
                    <hr>
                    <p>From: <h4><? echo $news_date; ?></h4></p>
                    <p><? echo $news_text; ?></p>
                     <object data="<? echo $news_image; ?>" type="application/pdf" width="100%" height="550px">
  <p>Alternative link - <a href="<? echo $news_image; ?>">PDF Viewer</a></p>
</object>
                    <?  
                    }
                    ?>




                    </div>
                    </article>
                    </div>  
                    <?  

                    } else {
                        if($news_image == ''){
                        $news_dp_image = 'assets/images/default.jpg';
                    } else {
                        $news_dp_image = 'news_images/'.$news_image;
                    }
                    ?>



                    <!-- ======================= ARTICLE #4 ======================-->
                    <div class="col-md-12">
                      <article class="post">
                        <div class="row">
                          <div class="col-md-3 col-sm-3 col-xs-2">
                            <figure class="stretchy-wrapper ratio_1-1"><a href="full_news.php?id=<? echo $news_id; ?>" title="Post" style="background-image: url('<? echo $news_dp_image; ?>'); box-shadow: 0 1px 5px rgba(0, 0, 0, 0.4), 0 1px 5px rgba(130, 130, 130, 0.35);"></a></figure>
                          </div>
                          <div class="col-md-9 col-sm-9 col-xs-12">
                            <h3 class="post_title"><a href="full_news.php?id=<? echo $news_id; ?>"><i class="fa fa-chevron-circle-right" aria-hidden="true"></i> <b><? echo $news_title; ?></b></a></h3>
                            <p><? echo $news_tagline; ?></p>
                            <div class="post_figure_and_info">
                              <div class="post_sub"><span class="post_info post_date"><i class="fa fa-calendar"></i> <? echo $news_date; ?> </span><a href="#"><span class="post_info post_author">at <i class="fa fa-clock-o" aria-hidden="true"></i> <b><? echo $news_time; ?></b></span></a><a href="#"><span class="post_info post_categories"><i class="fa fa-calendar-o" aria-hidden="true"></i> <b><? echo $news_type; ?></b></span></a></div>
                            </div>
                            <p><a href="full_news.php?id=<? echo $news_id; ?>" class="btn btn-primary"><i class="fa fa-info-circle" aria-hidden="true"></i> Read More</a></p>
                          </div>
                        </div>
                      </article>
                    </div>

                    <?
                    }
              }
          } else {
              ?>


              <hr>

              <?
          }
              ?>

How it displays: 显示方式:

0) { while($row = mysqli_fetch_assoc($result)) { $news_id = $row['news_id']; 0){while($ row = mysqli_fetch_assoc($ result)){$ news_id = $ row ['news_id']; $news_type = $row['news_type']; $ news_type = $ row ['news_type']; $news_title = $row['news_title']; $ news_title = $ row ['news_title']; $news_tagline = $row['news_tagline']; $ news_tagline = $ row ['news_tagline']; $news_date = date('dS F Y', strtotime($row['news_date'])); $ news_date = date('dS F Y',strtotime($ row ['news_date']));; $news_time = date('H:i', strtotime($row['news_date'])); $ news_time = date('H:i',strtotime($ row ['news_date'])); $news_image = $row['news_image']; $ news_image = $ row ['news_image']; if($news_type == 'PDF'){ $news_text = $row['news_text']; if($ news_type =='PDF'){$ news_text = $ row ['news_text']; ?> From: ?>来自:

From: 从:

Any ideas as to why this might be happening? 关于为什么会发生这种情况的任何想法? I've tried different PHP versions and such but I don't get many options... 我已经尝试过不同的PHP版本,但是我没有太多选择...

Performance settings
memory_limit 
128M (Default)
max_execution_time 
30 (Default)
max_input_time 
60 (Default)
post_max_size 
8M (Default)
upload_max_filesize 
2M (Default)
opcache.enable 
on (Default)
Common settings
include_path 
.:/usr/share/php (Default)
session.save_path 
/var/lib/php/sessions (Default)
mail.force_extra_parameters 
open_basedir 
{WEBSPACEROOT}{/}{:}{TMP}{/}
error_reporting 
E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED
display_errors 
off (Default)
log_errors 
on (Default)
allow_url_fopen 
on (Default)
file_uploads 
on (Default)
short_open_tag 
off (Default)

As suggested in my comment , the issue was that short open tags ( <? ) were disabled / not interpreted. 我的评论所建议,问题是短开放标签( <? )被禁用/未解释。 Changing them to <?php solved the issue. 将它们更改为<?php解决此问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM