No categories assigned

Environment Variables (Windows)

For using console commands for PHP ans MySQL in a comfortable way, some settings in the environment variables should be done. This document describes how to do this. 

Reviewing paths

You need to know in which paths of your Windows installation the following files are located: 

  • php.exe
  • mysql.exe

This document uses these paths as an example:

  • C:\Program Files (x86)\PHP\php-5.6.30\php.exe
  • C:\Program Files\MariaDB 10.1\bin\mysql.exe

Entering environmental variables

  1. Press the key combination "Windows+R" to start the input request 
  2. Start the program "SystemPropertiesAdvanced.exe"
  3. Click at "Environment Variables"

    Setup:Setup windows environment variables 01.jpg
  4. Open the variable "Path" at "System variables" with a double click

    Setup:Setup windows environment variables 02.jpg
  5. With Windows 2012: In the line "Value of Variables", add the paths to php.exe and mysql.exe, separated by semicolon, directly at the beginning of the line. Regarding the path example, this would be "C:\Program Files (x86)\PHP\php-5.6.30\;C:\Program Files\MariaDB 10.1\bin\;"

    Setup:Setup windows environment variables 03.jpg
  6. Windows 2016 and above: Add two new entries with their respective pathnames

    Setup:Setup windows environment variables 04.jpg
  7. Close all windows by clicking "OK"
  8. Restart the command line

Now you should be able to call up the commands "php" and "mysql" without problems in the command line.

Attachments

Discussions