Php command not found xampp

I am running Xampp on my Windows 7 machine and was wondering if and how I could run commands for xampp via a command line. commands like php phpfile.php

Any advice would be appreciated.

asked May 25, 2012 at 10:44

XAMPP does not have a pre build console to run php or mysql commands, so, you have to add to windows PATH environment variables, these 2: ;C:\xampp\mysql\bin;C:\xampp\php;

Then you should be able to execute php and mysql commands from the CMD.

UPDATE

I tested it, and it works.

answered May 25, 2012 at 10:51

AlexAlex

7,41022 gold badges82 silver badges150 bronze badges

1

  • You can set environment variables as mentioned in the other answers (like here)

    or

  • you can open Start > CMD as administrator and write

    C:\xampp\php phpfile.php

Php command not found xampp

giovannipds

2,3122 gold badges28 silver badges36 bronze badges

answered May 27, 2012 at 13:06

1

Thank you guys for this answers. But I think the accepted answer needs more clarity, As i found difficulty in getting the solution.

  1. We may set the environment variable as mentioned in the answer by w0rldart .

    In this case(after seting envmnt var) we may run the phpFile by opening start >> CMD and typing commands like,

    php.exe

    or

    php

    example:

    php.exe C:\xampp\htdocs\test.php
    
  2. you can open Start >> CMD as administrator and write like

    example:

    C:\xampp\php\php.exe C:\xampp\htdocs\test.php
    

    or

    C:\xampp\php\php C:\xampp\htdocs\test.php
    

Hopes this will help somebody.

answered Feb 22, 2014 at 18:38

sktskt

4024 silver badges12 bronze badges

1

Run PHP file from command Promp.

Please set Environment Variable as per below mention steps.

  1. Right Click on MY Computer Icon and Click on Properties or Go to "Control Panel\System and Security\System".
  2. Select "Advanced System Settings" and select "Advance" Tab
  3. Now Select "Environment Variable" option and select "Path" from "System Variables" and click on "Edit" button
  4. Now set path where php.exe file is available - For example if XAMPP install in to C: drive then Path is "C:\xampp\php"
  5. After set path Click Ok and Apply.

Now open Command prompt where your source file are available and run command "php test.php"

answered Mar 27, 2017 at 16:35

Php command not found xampp

Kaushik AndaniKaushik Andani

1,2021 gold badge12 silver badges22 bronze badges

In case some one wants to know how to set up Environment variables

  1. Click on the windows button on the bottom left and go to System
  2. Click the Advanced System Settings link in the left column
  3. In the System Properties window, click on the Advanced tab, then click the Environment Variables button near the bottom of that tab.
  4. In the Environment Variables window , highlight the Path variable in the "System variables" section and click the Edit button. Add the path lines with the paths you want the computer to access.

Once you have done that you can run using the command from the start->command line as below

php 

answered Mar 25, 2016 at 4:40

HopeKingHopeKing

3,0154 gold badges37 silver badges58 bronze badges

Like all other had said above, you need to add path. But not sure for what reason if I add C:\xampp\php in path of System Variable won't work but if I add it in path of User Variable work fine.

Although I had added and using other command line tools by adding in system variables work fine

So just in case if someone had same problem as me. Windows 10

Php command not found xampp

answered Sep 25, 2017 at 15:15

Php command not found xampp

cjmlingcjmling

6,59110 gold badges40 silver badges73 bronze badges

0

Please renember: When you change the path variable, you need to restart the console otherwise the path variable is not updated and does not seem to work.

answered Apr 4, 2018 at 8:38

Php command not found xampp

1

In the version 3.2.4 of the XAMPP Control Panel, there is button that can open a command line prompt (red rectangle in the next figure)

Php command not found xampp

After pressing the button, you will see the command prompt window.

Php command not found xampp

From this window you can navigate through the different folders and start the different services available.

answered Jun 21, 2020 at 14:45

Php command not found xampp

Xampp has the php application under: C:\xampp\php file directory ... if you input C:\xampp\php\php in CMD it should enter the php application.

answered Jun 21, 2017 at 9:17

0

A faster option would be to use CMD as administrator. You could type, for example:

setx PATH "%PATH%;C:\xampp\php"

After this, you need to close CMD and reopen. For test type:

php -v

answered May 18 at 15:16

How can I get PHP path in XAMPP?

Make sure that you're on the Advanced tab..
Scroll down to the Path variable and click Edit..
Click on the Browse button..
Navigate to C:/xampp/php and click OK..
You will now see the path to php inside the window. Click OK to exit..
Restart your Command Prompt window if it's open and type in: php -v..

How do you fix PHP is not recognized as an internal or external command?

Follow these steps:.
Go to System Properties..
Go to Advanced..
Go to Environmental Variables..
Edit the Path environment variable..
Add the installation path of xammp/wamp like in my case the path is E:\xammp\php..
Click on Ok..
Restart command prompt (cmd).
Check the version of PHP by running php --version ..

How do I start PHP in XAMPP?

How to Run a PHP Code Using XAMPP?.
Go to “C:\xampp\htdocs” and inside it, create a folder. ... .
Inside the demo folder, create a new text file and name it “index. ... .
Now, to see the script output, open the XAMPP control panel and start Apache to host the local webserver, where our script will be running..

Is PHP installed with XAMPP?

XAMPP is a free, easy-to-install Apache distribution containing MariaDB, PHP, and Perl.