简体   繁体   中英

Running PHP Script In Powershell keeps opening NotePad ++ rather than executing the PHP script

Okay, I'm at a bit of a loss here.

I'm testing out running PHP scripts from within powershell and it just keeps opening NotePad ++ rather than executing the script. I cannot figure out why this won't work...

I'm using a pretty basic PHP script to test:

<?php
    echo 'Hello, World!';
?>

And I'm calling it using the standard way I run.ps1 files:

PS C:\php> c:\phpfiles\test25.php

The execution policy is set to unrestricted... what am I doing wrong?

You should pass the path of the file as an argument to the PHP executable. If (lets say) PHP is installed in c:\php, then you must do:

PS c:\php\php.exe -f c:\phpfiles\test25.php

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