Home >Backend Development >PHP Tutorial >How to Access XAMPP\'s Command Line on Windows?

How to Access XAMPP\'s Command Line on Windows?

Barbara Streisand
Barbara StreisandOriginal
2024-10-18 12:55:321011browse

How to Access XAMPP's Command Line on Windows?

Accessing the Command Line for XAMPP on Windows

Running XAMPP on Windows can be a convenient way to set up a local development environment. However, some users may find it frustrating that there doesn't seem to be a built-in command line for XAMPP.

Can I Run XAMPP Commands from the Command Line?

While XAMPP itself doesn't provide a dedicated console, it is possible to access the command line for XAMPP and run commands such as "php phpfile.php".

Solution: Modifying Path Environment Variables

To do this, you need to add two specific paths to the Windows PATH environment variables:

  • C:xamppmysqlbin
  • C:xamppphp

How to Add Paths to the PATH Variable

  1. Right-click "Computer" (or "This PC") on your desktop.
  2. Select "Properties" and click "Advanced system settings."
  3. Under "Advanced," click "Environment Variables."
  4. In the "User variables" section, scroll down and find the "Path" variable.
  5. Select the "Path" variable and click "Edit."
  6. At the end of the "Variable value" field, add a semicolon (;) followed by the two paths specified above:

    • ;C:xamppmysqlbin
    • ;C:xamppphp
  7. Click "OK" and close the Environment Variables window.

Once you've made these changes, you should be able to open the Command Prompt (cmd.exe) and execute PHP and MySQL commands from it. For example, to run a PHP file named "phpfile.php", you would type the following command:

php phpfile.php

The above is the detailed content of How to Access XAMPP's Command Line on Windows?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn