Today, We want to share with you PHP Get Full URL PATH QUERY STRING.In this post we will show you PHP Get Absolute Path, Document Root, Base URL, hear for PHP Document Root, Path and URL detection we will give you demo and example for implement.In this post, we will learn about how to find the exact path of the file upload in php with an example.


There are the Following The simple About PHP Get Full URL PATH QUERY STRING Full Information With Example and source code.

As I will cover this Post with live Working example to develop Get current URL path in PHP, so the some php get current url without query string for this example is following below.

Read Also:  Calculate days between two dates in jquery

PHP Get full url with parameters

Full URL :”.””;
echo “


echo “Path :”.$path = $_SERVER[‘PHP_SELF’];
echo “


echo “File Name :”.$file_name = basename($_SERVER[‘PHP_SELF’]);
echo “


echo “Get the absolute path :”.$base_dir = __DIR__;
echo “


echo “Get the document root :”.$doc_root = preg_replace(“!${_SERVER[‘SCRIPT_NAME’]}$!”, ”, $_SERVER[‘SCRIPT_FILENAME’]);
echo “


// server protocol
echo “Get the server protocol :”.$protocol = empty($_SERVER[‘HTTPS’]) ? ‘http’ : ‘https’;
echo “

Read Also:  Get the full URL in PHP


// domain name
echo “Get the server protocol :”.$domain = $_SERVER[‘SERVER_NAME’];
echo “


// base url
$base_dir = __DIR__;
echo “Get the base url :”.$base_url = preg_replace(“!^${doc_root}!”, ”, $base_dir);
echo “


// server port
echo “Get the server port :”.$port = $_SERVER[‘SERVER_PORT’];
echo “


//PHP Get URL with Parameter
echo “PHP Get URL with Parameter :”.$_SERVER[‘REQUEST_URI’];
echo “


echo “


//PHP Get hostname
echo “PHP Get hostname :”.$_SERVER[‘HTTP_HOST’];
echo “



Paths and Directories in PHP


Full URL :

Path :/pakainfo-apps-demo-examples/blog/test.php

File Name :test.php

Get the absolute path :/home/pakainfo/public_html/pakainfo-apps-demo-examples/blog

Get the document root :/home/pakainfo/public_html

Get the server protocol :https

Get the server protocol

Get the base url :/pakainfo-apps-demo-examples/blog

Get the server port :443

PHP Get URL with Parameter :/pakainfo-apps-demo-examples/blog/test.php?id=5&name=userfname

PHP Get QUERY_STRING :id=5&name=userfname

Angular 6 CRUD Operations Application Tutorials

Read :

Read Also:  PHP Get domain name from full URL with parameters


You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about PHP Get Full URL PATH QUERY STRING.
I would like to have feedback on my blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Related FAQ

Here are some more FAQ related to this Article:

  1. Read Also:  CheckBox Show Hide Div using Angular Example
  2. Read Also:  MySQL AND Comparison Functions and Operators By Example
  3. Read Also:  Retrieving URL Query String in PHP
  4. Read Also:  PHP Get Current URL Full Path HTTP-HTTPS Protocol
  5. Read Also:  How to get the current page name using PHP?
  6. Read Also:  how to declare an empty array in java?
  7. Read Also:  PHP Remove specific value from array
  8. Read Also:  PHP Sending Mail Contact Form with jQuery AJAX
  9. Read Also:  VueJS Global Constants Set and Get Variables
  10. Read Also:  PHP Codeigniter 3 Multiple WHERE conditions Example