apache_lookup_uri
(PHP 3>= 3.0.4, PHP 4)
apache_lookup_uri — ��������� ��������� ������ �� ������������������ URI � ���������� ��� ���������� � ��.
��������
object apache_lookup_uri (string filename)
��������� ��������� ������ �� URI. ��������� ����������, ����� �������� ��� ������ ���������� � ������ �������, � ���������� ��� ���������� � ������.
�������� ������������� ������:
status |
the_request |
status_line |
method |
content_type |
handler |
uri |
filename |
path_info |
args |
boundary |
no_cache |
no_local_copy |
allowed |
send_bodyct |
bytes_sent |
byterange |
clength |
unparsed_uri |
mtime |
request_time |
����������: apache_lookup_uri() �������� ������ �����, ����� PHP ���������� ��� Apache-������.
Linux.yaroslavl.ru
apache_lookup_uri
��������
class apache_lookup_uri (string filename);
��������� ��������� ������ ��� ���������� URI. �������� ��� ������ ���������� � �������� ������� � ���������� ��� ���������� �� �������. �������� ������������ �������:
status |
the_request |
status_line |
method |
content_type |
handler |
uri |
filename |
path_info |
args |
boundary |
no_cache |
no_local_copy |
allowed |
send_bodyct |
bytes_sent |
byterange |
clength |
unparsed_uri |
mtime |
request_time |
apache_note
��������
string apache_note (string note_name, string [ note_value ]);
apache_note() ��� ����������� ������� Apache ������� �������� � ������������� �������� � ������� �������(����������) �������. ��� ������ � ����� ���������� ��� ���������� ������� �������� note_name . ��� ������ � ����� ����������� ��� ������������� �������� �������(����������) note_name � note_value � ���������� ���������� �������� �������(����������) note_name .
getallheaders
��������
array getallheaders (void);
��� ������� ���������� ������������� ������ �� ���� HTTP ���������� � ������� �������.
����������: GetAllHeaders() �� ������ ������ ��� �������������� ������ ���� PHP ������� ��� ������ Apache .
virtual
��������
int virtual (string filename);
virtual() �������� ����.�������� Apache, ������� ������������ � mod_include. ��� ��������� ��������� Apache. ��������� ��� ��������� CGI �������� ��� .html ������, ��� ����-������ ���, �� ��� �� ������ ��������� �������(������ ������) ����� Apache. �������, ��� ��� CGI ��������, ������ ������ �������� ������������ ���������. �.�. ������ ���� ��� �������� Content-type ���������. ��� PHP ������, �� ������ ������������ include() ��� require() .
��� ����� ��� apache_lookup_uri
(PHP 3>= 3.0.4, PHP 4 , PHP 5)
apache_lookup_uri — Осуществить частичный запрос на указанный URI и вернуть все полученные сведения
Описание object apache_lookup_uri ( string filename )
Эта функция осущестслвяет частичный запрос на указанный URI и, проведя анализ полученных данных, возвращает их в классе. Свойствами возвращаемого класса являются:
status |
the_request |
status_line |
method |
content_type |
handler |
uri |
filename |
path_info |
args |
boundary |
no_cache |
no_local_copy |
allowed |
send_bodyct |
bytes_sent |
byterange |
clength |
unparsed_uri |
mtime |
request_time |
Замечание: Функция apache_lookup_uri() доступна только в том случае, если PHP работает в качестве модуля Apache.
���� � Apache
������� �� ��� ������� ������ �������� ������ � ��������� �� ������ ������������. ��� ����� ������ ��-�������: ��������� �������, ��������, HotLog, ��������� ������ ������, �� � ��������� ������ ��� � ������� ����� Apache. ��-��, �� �� ����������, Apache ���� ����� ����.
�� �������� ���������� ������ �������� ����� ���� ��������: LogFormat � CustomLog. ���� ��� ��������� ErrorLog, �� ����� � ��������� ��� ������ ������ ��� ��������� ��������� �������, ����� Apache �� ���������. ���-���� ����� ��������� ���� � ErrorLog.
���� ������������ ������� ��� ������ �������, ����������� ���������� ErrorLog, � �������� ��� ��������� �� ������� � ��� �����������, �������� ������ �����. �� ������ ��. �����-��� ��������� ���:
����������� ����� �� �������������, ������ ���� ������ ��������� LogLevel. ��� ���� �������� ������� ������ ��� �� ������ � ��� ������ ��������� ������� �������. ��������, ���������
�������� ������ ���������� ������ �� ����� ����������� ��������, ����� ������ �� �����������. ����� ��������� �� ���������: alert, crit, error, warn, notice, info �, ������� ��, ��� �������
��� ������� ��� ����� ���������� ���� � ���, ��� ������ ���-���� ��������� � ������ ������ ���� ������������ ??
����� �������, ���� ��� ����� ���� ������, �� � httpd.conf ������� ������� ��������� ErrorLog � ���������� ���� ���� (���� ��������� ������������ ServerRoot) � LogLevel � ���������� �������� ��������. ����� ��� �� ����� ������� ??
������ � ���, ��� ������ ������ �: Combined Logs. ��� ���� ���������� � ���, ���, ����� � ����� ��������� ������� � �������. ������, ���������? ����� ��� ��� ���������: LogFormat � CustomLog. ����������� � �����-������ httpd.conf � �� ����������� ������� ��� ���-������ ����
���, ��� �������? ������ ������� ��� ��� ������. LogFormat ��������� ��� ���������: �������� ������� ���� � �������� ����� �������. ��� ������, ���, ��������� �� �%h %l %u %t �%r� %>s %b� ���������� common. � ��� ������ ���������, ������� ���:
%h � IP �������. ������, ��� �������� ����� ���� � �� ��� ������.
%l � ��� ���-�� ����������, ���������� ������������� ������� �� RFC 1413. ������, ���� �� �������� �� ����������, ���� ������ ��������� IdentityCheck �� ����������� � On
%u � ��, ��� ���� ������� � �������� ����� ������������ � HTTP-�����������. �� �� �����, ��� � $HTTP_AUTH_USER ??
%t � ����� ����������� �������. � ������������ �� ���������.
%r � ������ ������� �������, �������� �GET /xxx.gif HTTP/1.1�. ������ ����������� � �������, �� ��������� ������� � �����������, ��� ������������ ���������� � . ����� �������, ��, ��� ����� ��������� � ���� ��� ������� � ��������, ����������� ���: �%r�
%>s � ��� ������ ������� �������.
%b � ������ ������ �������. � ������.
%
%
��� ��������� ����� ������������� � ����� ������� � � ����� ����������. �������� ���������� ������ IP ����������� � ������ ���:
��� � ��������� ����� ������ ����. � �����, ������������ ��� ������. �� ���� ��� ��������� �� �������. ����� ������ ����� ������ ���, ���� ����������� ����� ���������� CustomLog, ������� ��������� ��� ���������: ��� ����� ���� � ��� ���. ����� �������, ����� ���������� IP ��������, ���� �������� ��� � ����� �������:
� ������ ����� ����� ��� ������ ��������� �������. ������, ���������� ��������� �������� �combined log�, ������������� ���:
��� ������, �������� ������������. � ������ �� ������ ����������� ����, ��� ��� ������ ������������ ����� �������� �������� � ����. � ��� ����� ����� ��������� �����. �� ��� ������� �������: ������� ������� ��� CustomLog, ������� ����� � ���������, � �� ��� ��� ��������� ���� �����������, ������ robots.txt ������ � ��������� ���? �����. �����������.
���� ��� ����� �������� ��������� SetEnvIf (��� SetEnvIfNoCase � �� �� �����, �� ��� ����� �������/��������� ����), ��� ��������� � ����������� �� ������� ���������� ���������� �����. ��������:
����� ����� ���������� env ����� ��������� �crawler�. �� ��� ��� �� ���! � ����������� �� �������� ���� ���������� �� ������ ������ ������ � ������ ����! ��� ���:
��� ���, ������ ����� ����� � ��� �� ����� ?? �� ���� ������������ ������ robots.txt ��� ������� ��������, ���������� ��� ���������� ���������, � �������� ��� ��� ����� ���� � ��������, ���� � �������� ������� ����� �� ����� perlre. ��� ���: man perlre. ��� �������, ������� ??
��� ���, �����? ���, ���� ��� ����. ���� (pipes) ��������� �������������� (������ ��� ����-�� � ���� ��������), ���-������ ������ � ���� ���������, �������� �����. ����������� ������ ���� � ������ � ������������ �����, ��� ��� ���� ��� ��������� ���� ����� �������, ������� ���:
��� ��� ������� ?? ������ ������, ��� ���� � ��� ���� �� �����, �� ���� ����� ������� � ������ ��� � ��� �������� �������� %)
��� ����� ��� apache_lookup_uri
(PHP 3 >= 3.0.4, PHP 4, PHP 5)
apache_lookup_uri — Perform a partial request for the specified URI and return all info about it
Description object apache_lookup_uri ( string filename )
This performs a partial request for a URI. It goes just far enough to obtain all the important information about the given resource.
This function is only supported when PHP is installed as an Apache module.
Parameters
The filename (URI) that’s being requested, or FALSE on failure.
Return Values
status |
the_request |
status_line |
method |
content_type |
handler |
uri |
filename |
path_info |
args |
boundary |
no_cache |
no_local_copy |
allowed |
send_bodyct |
bytes_sent |
byterange |
clength |
unparsed_uri |
mtime |
request_time |
Examples
Example 1. apache_lookup_uri() example
The above example will output something similar to:
apache � �������� / ������������� MIME-��� ogv �� PHP fileinfo
� ���������� ��� �� ����������� ��������, ������� � ���� ����, � PHP, �������, ���������� application/ogg ��� ogv ����� ������. ��� �������, ������ ��� ���������������� ���� Apache MIME ����� ����������� video/ogg (����� �� ����������, ��, �� ������� ����, ��� ����� �� �����, ��������� ���������� ������ ��������� ������). ������������� � ���������� � ���� ��������� � Responsive File Manager, �� ���� ������������� �� ��������������.
������ ��������� ��� ���������� � ��� � ���� �� ��������?
���� �������� .htaccess, ������, ������ �� ��������. ��������, ����� ����� ��������, ��� � ��������� cPanel / WHM, �� �� ���� ����� ������� �������������� ��������������� ������������. ����� ����, cPanel ����� ���� video/ogg ��� ���, ��� � Apache.
����� �����
������ � �� ������� ������ ������������ ������� ����� � ��������, ������� � �������� ������� ��������-�������� � ������, ���������� ������������ � 20-������ ������ � ����������� ���������, ������� �� ��� ��� � ����.
����� ��������� �� ������ ������������� ������� ������ ����, ������������ ������������ � �������� �����, � ��� ����� ������������ � ���� ����������� ������������ ����� ��������, ��������� � ������������� ��������-���������. ���� ����� � ��������� � ������, ������ � ������������ � ���������, ��������� �������� ��������� �� ���������� ��� ���������� ������ ������, � ������� ��������� � ������������ ��������, ���������� � ������ ������.
����� ������ �������� ������� ��������-����������. �������������� �� ������ � �������� ������� ����������� ����������� � �� ����������� �������������, �� � �� ������������� ������������� �������, � ������ �� ���������������� ��������, ��-�� ������� ������ ������������� ����������� ������������� �� ����������� �����������. � ���������� �����, �����������, ������ � ��������� ����� ������, ����������, ���������, �������������� ������������, � ����� ����������� ������� ������ �� ���-���������.
����� �������� ��������� �������� �� �������� ������� ������������ � ���������� ��������, � ����������� ������� �������� ������, ��-�� ������� ������� ������ ���������, � ����� ������ ������� ��������-��������.
����� ����� ���� ��������-������� �� � �� , �� � ������� ����������� � ������������� ��� ����������� ���������, ������� ����������� �������� ������������� ������� ��������-��������, ���� ������� �����, ������ �� ��������� � ������� ����.
����� ������������� �� ������ �������� ��������-�������, �� � ������������� � ���-���������� ����� ���������� ��������, ����� ������� ����� ������ ��� ������� ������ ��������-�������� � ����������� �������� ���� ������������.
apache_lookup_uri
| |||||||||||||||||||||||||||||||||||||||||
status |
the_request |
status_line |
method |
content_type |
handler |
uri |
filename |
path_info |
args |
boundary |
no_cache |
no_local_copy |
allowed |
send_bodyct |
bytes_sent |
byterange |
clength |
unparsed_uri |
mtime |
request_time |
����������: apache_lookup_uri() �������� ������ �����, ����� PHP ���������� ��� Apache-������.
percent encoding, urlencode(), Apache � ������������� URI
������ ���, ��������, ���������� ������� ������, �� �� ���� ����� � ��� ����������� ��������������.
�������� ���������: ��� � ��� ��������� �������� ��������� � ����������� �������������� ���������. � ����, ����� ��� ��������� ����� ��� � ���� ������� «/Id-title», ��� id — �������� ������������� ��������, � title — ����� �������, ������� ����������� � ������� urlencode() �� �������� ������������� ���������� ��� �������� ���� ���������. ��� ��������� ����� �������, ��� title ��� urlencode() �� ����������������� �����.
������� ������, ������� ���� ����������, ��� ��� ��������� ����������� ������������ ������������� ����� ������, ������� �� �������� «�����������» ��������� �������?
������ ��������:
���, �������� ������ ������������ ������ «����/����» (UTF-8), ������� �������� ������ ����. urlencode() ���������� � �
%D1%82%D0%B5%D1%81%D1%82%2F%D1%82%D0%B5%D 1%81%D1%82, ������� �����, ����� �� ������������, �������� ������������. �� ������, �� ��� ���� ��� ����������� �������, ���������� %-������������ ������ ����, ��� ���� (1.3.33 �� �������2) �������� ���������� ��� � ����, ��� �� urldecode(), �.�. �� �������, ��� ��� ���� ������ ���� �, ��������������, �������� ����� ������ �� ������ «����/����», �� ������� ��� � ����� ����������� ���������� 404 not found.
���������� .htaccess �� ����� ������� ���������:
RewriteEngine on
RewriteCond %
RewriteRule .*$ index.php [L]
�.�. ������������ ������ ��������� � ������������ ������, �� ��������� ������ ������������ �� index.php. �� � ������ ������ ���� �� ����� — �� ������������.
������� ������, ��� � ������� ��������: ����� ��� �������, ����� «/» ������� ������������ � ��������, ���������� �� �����, ������������������? ������� �������, �� ��� ��� ���� ����� ��� ������� �����������?
������ ������: ������ ���� ����� �������� ������������ %2F � ��������������� ���� «/» � ����� ���� ���������� ���� �� �������� ��� ���, ���� �� ��������� %-����������� URL ��������� �������� � ��� index.php? ��� ��� ���������, ����� �� ����� �� �����?
Resolved. �������, ��� ��������� ����� by design, ����������� ����������
AllowEncodedSlashes ������� � ������ 2.0.46 ( http://httpd.apache.org/docs/2.0/mod/core.html#allowencodedslashes ).
����������, ������������ ���� ��� ������� ������ � �������� �����.
�� ������� �������� ������� tishetsky
��� ����� ��� apache_lookup_uri
(PHP 3>= 3.0.4, PHP 4 , PHP 5)
apache_lookup_uri — Perform a partial request for the specified URI and return all info about it
Description object apache_lookup_uri ( string filename )
This performs a partial request for a URI. It goes just far enough to obtain all the important information about the given resource and returns this information in a class. The properties of the returned class are:
status |
the_request |
status_line |
method |
content_type |
handler |
uri |
filename |
path_info |
args |
boundary |
no_cache |
no_local_copy |
allowed |
send_bodyct |
bytes_sent |
byterange |
clength |
unparsed_uri |
mtime |
request_time |
Example 1. apache_lookup_uri() example
if ( file_exists ( $info -> filename )) <
echo ‘file exists!’ ;
>
?>
The above example will output something similar to:
stdClass Object ( [status] => 200 [the_request] => GET /dir/file.php HTTP/1.1 [method] => GET [mtime] => 0 [clength] => 0 [chunked] => 0 [content_type] => application/x-httpd-php [no_cache] => 0 [no_local_copy] => 1 [unparsed_uri] => /dir/index.php?var=value [uri] => /dir/index.php [filename] => /home/htdocs/dir/index.php [args] => var=value [allowed] => 0 [sent_bodyct] => 0 [bytes_sent] => 0 [request_time] => 1074282764 ) file exists!
Note: apache_lookup_uri() only works when PHP is installed as an Apache module.
apache_lookup_uri
(PHP 3>= 3.0.4, PHP 4)
apache_lookup_uri — ��������� ��������� ������ �� ������������������ URI � ���������� ��� ���������� � ��.
��������
object apache_lookup_uri (string filename)
��������� ��������� ������ �� URI. ��������� ����������, ����� �������� ��� ������ ���������� � ������ �������, � ���������� ��� ���������� � ������.
�������� ������������� ������:
status |
the_request |
status_line |
method |
content_type |
handler |
uri |
filename |
path_info |
args |
boundary |
no_cache |
no_local_copy |
allowed |
send_bodyct |
bytes_sent |
byterange |
clength |
unparsed_uri |
mtime |
request_time |
����������: apache_lookup_uri() �������� ������ �����, ����� PHP ���������� ��� Apache-������.