apache_lookup_uri – Execute a Partial Request for a Specified URI and Return All Related Information

The apache_lookup_uri function, available when PHP runs as an Apache module, performs a partial request on a given URI, returning an object with detailed request and file information such as status, method, headers, and timestamps.

Laravel Tech Community
Laravel Tech Community
Laravel Tech Community
apache_lookup_uri – Execute a Partial Request for a Specified URI and Return All Related Information

The apache_lookup_uri function performs a partial request for a given URL when PHP is installed as an Apache module, retrieving key information about the requested resource and then stopping.

Parameter filename – the requested file name (URI).

Return value

An object containing information about the URI, such as status, request method, modification time, content length, and other metadata.

Example

<?php
$info = apache_lookup_uri('index.php?var=value');
print_r($info);
if (file_exists($info->filename)) {
    echo 'file exists!';
}
?>

The printed object shows properties like 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, and request_time = 1074282764.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

HTTPPHPURIapache_lookup_uri
Laravel Tech Community
Written by

Laravel Tech Community

Specializing in Laravel development, we continuously publish fresh content and grow alongside the elegant, stable Laravel framework.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.