代码之家  ›  专栏  ›  技术社区  ›  Snappysites

不使用plesk的php脚本

  •  1
  • Snappysites  · 技术社区  · 8 年前

    这是我第一次和普莱斯克合作。在使用plesk之前,这个网站和脚本都是完全功能的所有php都可以正常工作,尽管一旦使用plesk将其移到另一个主机上,大多数php现在都显示为纯文本。其中一些include正在工作,但许多mysqli短命令不工作,例如;

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

    另外,当我尝试执行一个非常简单的测试时,例如;

    $test = 'hello';
    echo $test; 
    

    我什么也没回?以下是我正在使用的一个脚本的示例,以及它在网站上的显示方式…

    <?
    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>
    
                  <?
              }
                  ?>
    

    显示方式:

    0){while($row=mysqli fetch\u fetch\u assoc($result($result)){$news\u id=$row['news\u id'];$news\u type=$row['news\u type'];$news\u title=$row['news\u title'];$news\u title=$row['news\u tagline=$row['news\u tagline'];$news\u date'']]$news@news\u tagline=$row['ds f y,strtottime($row$row($row=mysrtotime($row$row=mysqls$row=mysql_image=$row['news_image'];如果($news_type='pdf'){$news_text=$row['news_text'];?> 发件人:

    发件人:

    你知道为什么会这样吗?我尝试过不同的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)
    
    1 回复  |  直到 8 年前
        1
  •  0
  •   Tobias K.    8 年前

    如中所述 my comment ,问题是打开的短标签( <? )已禁用/未解释。把它们改成 <?php 解决了这个问题。