PHP's HTTP authentication mechanism only works when PHP is running as an Apache module, so this feature is not available for CGI versions. In the Apache module PHP script, you can use the header () function to send the "authentication Required"
LAMPSource code-level research in the SeriesApacheThe specific content is as follows:
To start this topic, I want to solve the problem of why we need to do so first. To look at Apache at the source code level, you must first solve the attitude
The HTTP authentication mechanism of PHP is only valid when PHP runs in the Apache module mode. Therefore, this function is not applicable to CGI versions. In the PHP script of the Apache module, you can use the header () function to forward... the
PHP is a cross-platform server-side embedded scripting language. It relies heavily on the syntax of C, Java, and Perl, coupled with PHP's own features, so that WEB developers can quickly write dynamic pages. The latest version of PHP5.01 supports
PHP weakly typed language, case sensitive, scripting language (explanatory, text file execution), server side.OOP [Object Oriented programming]SAPI [Server application programming Interface]LinkServer-side application programming port. It is the
This article mainly introduced PHP 4 kinds of common operation way, this article explained the CGI, FastCGI, Apache2handler, CLI and so on 4 kinds of Operation Way, needs the friend may refer to under
Sapi:server application Programming Interface
$_server[' php_self ') #当前正在执行脚本的文件名, related to document root.
$_server[' argv '] #传递给该脚本的参数.
$_server[' argc '] #包含传递给程序的命令行参数的个数 (if run in command-line mode).
$_server[' gateway_interface ') #服务器使用的 the version of the CGI specification.
$_server['Remote_port']//Port. $_server['server_name']//the name of the server host. $_server['php_self']//the file name of the script being executed$_server['argv']//The arguments passed to the script. $_server['argc']//the number of command-line
Sapi:server application Programming Interface Service-side application programming port. He is the interface that PHP interacts with other applications, and PHP scripts can be executed in many ways, either through a Web server or directly on the
PHP programming often need to use some of the server's data, special $_server detailed parameters, easy to use later.
$_server[' php_self '] #当前正在执行脚本的文件名, associated with document root.
$_server[' argv '] #传递给该脚本的参数.
$_server[' argc ']
This is a technology of user authentication. User authentication is the first line of defense to protect network system resources, it controls all login and check the legality of access users, the goal is to allow legitimate users to access the
The first is PHP to get the current page URL:
Copy Code code as follows:
Get the current script URL
function Getcururl ()
{
if (!empty ($_server["Request_uri"]))
{
$scriptName = $_server["Request_uri"];
$nowurl =
$_server[' php_self '] #当前正在执行脚本的文件名, associated with document root.$_server[' argv '] #传递给该脚本的参数.$_server[' argc '] #包含传递给程序的命令行参数的个数 (if run in command line mode).$_server[' Gateway_interface '] #服务器使用的 the version of the CGI specification. For
;;;;;;;;;;;;
;; grammar;;
; The syntax for this file is very simple. White-space characters and lines starting with semicolons are simply ignored.
; Chapter headings (for example, [PHP]) are also simply ignored, even though they may be of some
Readers who surf the web often experience this: when accessing some resources on some sites, the browser pops up a dialog box asking for a username and password to access the resource. This is a technology of user authentication. User authentication
apache| Server Author: Xu Hui
Readers who surf the web often experience this: when accessing some resources on some sites, the browser pops up a dialog box asking for a username and password to access the resource. This is a technology of user
Apache Introduction
The Apache HTTP Server project is a cross-platform open source HTTP Server software that can be run on platforms such as Windows and UNIX, with the goal of providing a secure, efficient, extensible HTTP service. Apache httpd has
Today we will introduce you to the specific methods for PHP to obtain the function of the current url. Through understanding this function method, we will further deepen our understanding of the PHP language, improve Our learning level.
The PHP 5.0
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.