Apache Web Submit 403 error, Access Forbbiden, Undefined variable

Source: Internet
Author: User
Tags deprecated php error file permissions

The first time to build a webpage

Build a server environment with easyphp Dev 14.1 on native win8.1: PHP, Apache, MySQL

Write a blog site against the example in PHP + MySQL eight dynamic Web apps.

However, in 08, many of the contents of the book have not been keeping up with the times, leading to some inexplicable mistakes:

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. You should use the mysqli or pdo_mysql extension to replace it. See MySQL: Select API Guide and related FAQs For more information. To replace this function are:
? Mysqli_connect ()
? Pdo::__construct ()

    $db = mysql_connect ($dbhost, $dbuser, $dbpassword);    mysql_select_db ($dbdatabase, $db);    $link = Mysqli_connect ($dbhost, $dbuser, $dbpassword, $dbdatabase);


There are many similar mysql_ opening functions that cause warning:depricated.

Workaround: http://www.ttlsa.com/php/deprecated-mysql-connect/


The second one is:

The 403:access Forbidden error is prompted when the form is submitted. Generally at this error prompt we will check the file permissions problem, the network also gives a bunch of solutions, what to modify the Apache configuration file, set permissions what.

However, when the form is actually submitted through the header ("Location:") function to relocate to this file Script_name, the page before the submission of the form can be correctly displayed, the submission of the form relocated to their own files have permission problems, which is puzzling.

If you view the source file on the Uncommitted form page at this point and look at 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;

Find Data discovery:

PHP Error: notice:undefined variable:script_name write to:

$SCRIPT _name This variable out of the question. Search on the Internet, less information, no clear results, but look at the basic wording is $_server[' script_name ', probably the wording changed.
Change the above code in $http_host and $script_name to $_server[' http_host ' and $_server[' Script_name '].

You will be able to submit the form successfully.

For fast iterative techniques, you should choose a recent book or material to read to avoid this embarrassing situation.

First contact with web programming, above memo.



Apache Web Submit 403 error, Access Forbbiden, Undefined variable

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.