Results 1 to 6 of 6

Thread: What are an Environment Variables in PHP?

  1. #1
    Join Date
    Aug 2006
    Posts
    300

    What are an Environment Variables in PHP?

    Hi friends,
    I have recently started with the PHP programming language. I don't have much idea about PHP. So thought that you guys would help me in solving my doubt. I want to know what are an Environment Variables in PHP.?? Any other information about this topic would be grateful. Please help me as soon as possible.!!

  2. #2
    Join Date
    Aug 2006
    Posts
    235

    Re: What are an Environment Variables in PHP?

    A variable is a holder for a type of data. You can use a variable for holding numbers, strings, booleans, objects, etc. You can also keep the variable as null. You should be knowing that all the variables begin with a dollar sign "$" and the value can be assignes using the "=" operator in PHP. An environment variables in PHP are treated as regular variables. This includes the environment variables that are set by the server for a CGI program. Many useful environment variables specific to each user account are provided by the Media Temple (mt) platforms. These are available to the PHP scripting language, and their use can greatly increase the portability and maintainability of your scripts.
    3.2 (northwood)
    2gig ram
    ATI AIW X800xt 256mb
    Gigabyte GA-8knxp 875p Chipset
    Optiwrite 8X DVD Burner
    Win XP PRO Sp2 (Works Perfectly)
    2 SATA Raptor 74gig Raid 0
    2 7200 IDE 320gig HD

  3. #3
    Join Date
    Aug 2006
    Posts
    227

    Re: What are an Environment Variables in PHP?

    A large number of predefined variables to all scripts are provided by the PHP. The things like built-in environment variables, last error messages to last retrieved headers are represented by the variables from an external; variables.For accessing an environment variables from php, there are two ways :
    1. By using the function getenv() which will work from the CLI as well as via http.
    2. You can use the global array HTTP_ENV_VARS where all environment variables are exported, if you're using PHP via HTTP. But for doing this you need to declare this as a global identifier.
    I do to dead flowers what people at morgues do to dead people. Suck all the moisture out, dip them in plastic, paint them up pretty and put them in a nice frame.

  4. #4
    Join Date
    Jul 2006
    Posts
    286

    Re: What are an Environment Variables in PHP?

    You can treat environment variables in PHP as regular variables. Lets have a look on example so that you may understand more clearly. If the url of your current page is "http://www.PHPDemo.com/home/index.php", which contains the following code :
    PHP Code:
    <?php
    echo $_SERVER['REQUEST_URI'];
    ?>
    Then it will print out :
    /home/index.php
    IF you hate me, please don't mention it. I know who hates me and who doesn't. You really do not have to make fun of people....

  5. #5
    Join Date
    Jul 2006
    Posts
    442

    Re: What are an Environment Variables in PHP?

    An environment variables in PHP that are system defined variables can be accessible from anywhere inside the PHP code. The following are some of the environment variables include :
    • $_SERVER - This variable contains information about the server and the HTTP connection.
    • $_GET - This variable contains any information sent to the server as a search string as part of the URL.
    • $_POST - This variable contains any information sent to the server as a POST style posting from a client form.
    • $_COOKIE - This variable contains any cookie data sent back to the server from the client.
    "When they give you ruled paper, write the other way..." J.R.J.

  6. #6
    Join Date
    Mar 2008
    Posts
    672

    Re: What are an Environment Variables in PHP?

    You can use the following code for using the environment variables :
    PHP Code:
    <?php
    $newVar 
    $_COOKIE["myCookie"];

    $newVar $HTTP_COOKIE_VARS["myCookie"];
    ?>

Similar Threads

  1. c# environment variables
    By EULALIA in forum Software Development
    Replies: 3
    Last Post: 13-07-2009, 02:23 PM
  2. Replies: 3
    Last Post: 15-05-2009, 11:33 PM
  3. Replies: 2
    Last Post: 01-04-2009, 05:46 PM
  4. Setting environment variables?
    By Chaz in forum Vista Help
    Replies: 3
    Last Post: 18-01-2009, 09:22 AM
  5. set environment variables in script .bat
    By Creezeer in forum Windows Server Help
    Replies: 1
    Last Post: 14-03-2007, 12:06 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,718,278,003.44965 seconds with 17 queries