Apache web submit 403 error, access forbbiden, Undefined variable, forbbidenundefined
Build web page for the first time
Use easyPHP dev 14.1 On win8.1 to build the server environment: PHP, Apache, and MySQL
Write a blog website against the examples in PHP + MySQL eight dynamic Web application practices.
However, since, many contents have not kept up with the times, leading to some inexplicable errors:
The first one is:
PHP mysql_connect () function
Note:
This extension has been deprecated since PHP 5.5.0 and will be removed in the future. Replace it with MySQLi or PDO_MySQL extension. See MySQL: select the API guide and related FAQs for more information. To replace this function, you can:
• Mysqli_connect ()
• PDO ::__ construct ()
// $db = mysql_connect($dbhost, $dbuser, $dbpassword); // mysql_select_db($dbdatabase, $db); $link = mysqli_connect($dbhost, $dbuser, $dbpassword, $dbdatabase);
Similarly, many functions starting with mysql _ Cause warning: depricated.
Solution: http://www.ttlsa.com/php/deprecated-mysql-connect/
The second is:
The error 403: Access forbidden is prompted when the form is submitted. In this error message, we will check the file permissions. On the internet, we also provide a bunch of solutions for modifying the Apache configuration file and setting permissions.
However, after the form is submitted, the header ("Location:") function will be used to relocate to the SCRIPT_NAME of this file. The page can be correctly displayed before the form is submitted, it is confusing to submit a form and relocate it to your own file.
If you view the source file on the unsubmitted form page and check the output of the PHP interpreter on the server, you will find:
<form action = "<br /><b>Notice</b>: Undefined variable: SCRIPT_NAME in <b>C:\Program Files (x86)\EasyPHP-DevServer-14.1VC11\data\localweb\bigdataweb\viewentry.php</b> on line <b>85</b><br />?id=1" method = "post">
Undefined variable SCRIPT_NAME;
Data discovery:
PHP error: Notice: Undefined variable: SCRIPT_NAME written:
$ SCRIPT_NAME: The variable has a problem. I searched the internet for less information and did not find clear results. However, the basic writing method is $ _ SERVER ['script _ name'], which is probably changed.
In the above Code, change $ HTTP_HOST and $ SCRIPT_NAME to $ _ SERVER ['HTTP _ host'] and $ _ SERVER ['script _ name.
After modification, the form can be submitted smoothly.
For fast iteration technology, you should select the latest books or materials to read, so as to avoid this embarrassing situation.
For the first time, contact web programming.
Zookeeper