简体   繁体   中英

PHP7 not working from the command line

I just installed PHP7 on my windows 10 machine from here (the thread safe 64 bit version) http://windows.php.net/download#php-7.0

I manually set the path to the php folder and set up the php.ini . Whenever I want to use the php command it just goes into the next line without doing anything. It doesn't even matter what arguments I type in. There is no error message so I am clueless on what could be the problem.

Here is what happens:

PS C:\Users\Jakob> php
PS C:\Users\Jakob> php cjasdf
PS C:\Users\Jakob>

Even if i navigate into the php folder and execute the php.exe nothing happens as well:

PS C:\php> .\php.exe
PS C:\php> .\php.exe aleass
PS C:\php>

RE: Your comment about a missing Visual C/C++ runtime library

The first thing you need to do is update Windows with that runtime library Download it from here

Ok Power Shell is A completely different beast to the command prompt and all the usual DOS commands are replaced with PS commands

I got PHP to run in Power Shell like this

Running PHP by switching into the folder where PHP is installed

 PS > Set-Location c:\php
 PS > php -v

And here is how I would do it better, by adding the C:\\php folder to the PATH, but only for the duration of the PS Windows instance ie not a permanant change to the Windows PATH

Add your PHP folder to the WINDOWS PATH for the duration of this PS execution

PS > $ENV:Path = $ENV:Path + ";c:\php"

The CD (or the PS equivalent) into the folder containing your PHP CLI scripts

PS > Set-Location c:\php-source
PS > php test.php

Thanks, I have never used Power Shell before and finding this simple stuff out made me think I should spend some time learning more about it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM