简体   繁体   English

一些php脚本在树莓派Web服务器上不起作用

[英]some php scripts not working on raspberry pi web server

Hi i am trying to make a website to host on my raspberry pi. 嗨,我正在尝试制作一个网站来承载我的树莓派。 it is running Apache2 and php 5.6.3. 它正在运行Apache2和php 5.6.3。 here are the script that runs fine: 这是运行良好的脚本:

    <!DOCTYPE html>
    <html>
        <head>
            <title>Callums Smarthouse</title>
            <link rel="stylesheet" type="text/css" href="style.css">
        </head>
        <body>
            <?php include("header.php");?>
                <li><a class="active" href="index.php">Home</a></li>
                <li><a href="alarm.php">Alarm</a></li>
                <li><a href="cammera.php">Cammera</a></li>
                <li><a href="automation.php">Home Automation</a></li>
                <li><a href="settings.php">Settings</a></li>
                <li class="logout"><a href="logout.php">Log out</a></li>
            <?php include("header2.php");?>
            <div>
                <center>
                    <form action="index.php">
                        <input type="submit" value="Click to continue" />
                    </form>
                </center>
            </div>
            <?php include("footer.php");?>
        </body>
    </html>

But when i add this: 但是当我添加这个:

    <?php
        $mypass="password"
        $passcheck=$_POST["password"]
        if($passcheck==$mypass){
            echo"Welcome, ".$_POST["username"].". You are now logged in.</br>";
        }
        else{
            echo"Sorry the rong password was entered. Please try again";
        }
    ?>

The screen says: This page is not working 192.168.0.16 is currently unable to handle this request http error 500 屏幕上显示:此页面不起作用192.168.0.16当前无法处理此请求http错误500

It would be great if you could help. 如果您能提供帮助,那就太好了。

You have to set a semicolon (;) after the variable initialization. 您必须在变量初始化后设置分号(;)。 To debug easier, you can set a value in your php.ini file or via the ini_set() function for debug and error information (ini_set('display_errors', 1); And dont forget your semicolon at the end of each line ;) 为了更轻松地调试,您可以在php.ini文件中或通过ini_set()函数设置一个值,以获取调试和错误信息(ini_set('display_errors', 1);并且不要忘记每行结尾的分号;)

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

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