如何在WAMPServer中从Windows命令行运行PHP我对php很陌生,我想从命令行运行php。我已经安装了Wamp并将“系统变量”设置为我的php文件夹(它是C:\wamp\bin\php\php5.4.3).当我去Run -> CMD->类型php -a然后按回车,上面写着interactive mode enabled..但当我写echo 'Hi';什么都没显示出来。我甚至没有看到‘php>’之类的东西,当我键入php -a然后按回车。
3 回答
蛊毒传说
TA贡献1895条经验 获得超3个赞
c:\wamp\bin\php\php5.x.y\php.exe
phppath.cmd
:
PATH=%PATH%;c:\wamp\bin\php\phpx.y.z php -v
x.y.z
PHP_script.php
@echo off REM **************************************************************REM * PLACE This file in a folder that is already on your PATH REM * Or just put it in your C:\Windows folder as that is on the REM * Search path by defaultREM * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -REM * EDIT THE NEXT 3 Parameters to fit your installed WAMPServerREM **************************************************************set baseWamp=D:\wampset defaultPHPver=7.1.9set composerInstalled=%baseWamp%\composerset phpFolder=\bin\php\phpif %1.==. ( set phpver=%baseWamp%%phpFolder%%defaultPHPver%) else ( set phpver=%baseWamp%%phpFolder%%1)PATH=%PATH%;%phpver%php -v echo ---------------------------------------------------------------REM IF PEAR IS INSTALLED IN THIS VERSION OF PHP IF exist %phpver%\pear ( set PHP_PEAR_SYSCONF_DIR=D:\wamp\bin\php\php%phpver% set PHP_PEAR_INSTALL_DIR=D:\wamp\bin\php\php%phpver%\pear set PHP_PEAR_DOC_DIR=D:\wamp\bin\php\php%phpver%\docs set PHP_PEAR_BIN_DIR=D:\wamp\bin\php\php%phpver% set PHP_PEAR_DATA_DIR=D:\wamp\bin\php\php%phpver%\data set PHP_PEAR_PHP_BIN=D:\wamp\bin\php\php%phpver%\php.exe set PHP_PEAR_TEST_DIR=D:\wamp\bin\php\php%phpver%\tests echo PEAR INCLUDED IN THIS CONFIG echo ---------------------------------------------------------------) else ( echo PEAR DOES NOT EXIST IN THIS VERSION OF php echo ---------------------------------------------------------------)REM IF A GLOBAL COMPOSER EXISTS ADD THAT TOO REM **************************************************************REM * IF A GLOBAL COMPOSER EXISTS ADD THAT TOO REM *REM * This assumes that composer is installed in /wamp/composer REM *REM **************************************************************IF EXIST %composerInstalled% ( ECHO COMPOSER INCLUDED IN THIS CONFIG echo --------------------------------------------------------------- set COMPOSER_HOME=%baseWamp%\composer set COMPOSER_CACHE_DIR=%baseWamp%\composer PATH=%PATH%;%baseWamp%\composer rem echo TO UPDATE COMPOSER do > composer self-update echo ---------------------------------------------------------------) else ( echo --------------------------------------------------------------- echo COMPOSER IS NOT INSTALLED echo ---------------------------------------------------------------)set baseWamp=set defaultPHPver=set composerInstalled=set phpFolder=
> phppath
> phppath 5.6.30
www说
TA贡献1775条经验 获得超8个赞
开放式记事本 类型 php -S localhost:8000
将文件保存为 .bat
延期, server.bat
现在点击 server.bat
您的服务器已准备就绪的文件 http://localhost:8000
依赖性
"C:\wamp\bin\php\php5.4.3"
- 3 回答
- 0 关注
- 1278 浏览
添加回答
举报
0/150
提交
取消