Yii Framework Forum: php.exe is not recognized as an internal or external command. - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

php.exe is not recognized as an internal or external command. Rate Topic: ***** 2 Votes

#1 User is offline   Ganna 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 27-October 10

Posted 27 October 2010 - 03:52 PM

"php.exe is not recognized as an internal or external command", this was the message i received when i tired to install the yiic framework for the first time.

i figured it out eventually and here are the details:

you can solve this in two ways.

first method : edit the yiic.bat file.
you can modified the yiic.bat file in \YiiPath\framework\yiic.bat

find the path where php.exe resides on your disk, and simply add the line
cd C:\Program Files\PHPexeFolder\
on top of
%PHP_COMMAND% "%YII_PATH%yiic" %*

now save the yiic.bat file and run it.

second method : add the path to the system variables.
right click "my computer" go to "system properties" under "advanced" tab, click on "environment variables"
under "system variables" find for the variable named "PATH" and click on "Edit" button
in "Variable Value" append the php.exe path with a semi-colon like below (without the inverted commas)
";C:\Program Files\PHPexeFolder\"

Hope this helps anybody :)
Ganna..
0

#2 User is offline   Otto 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 02-November 10

Posted 02 November 2010 - 04:29 AM

Hi!
I think I do exactly the way you discribe.
I still have the same error.
After editing the bat-file it look like this:

@setlocal
set YII_PATH=%~dp0
if "%PHP_COMMAND%" == "" set PHP_COMMAND=php.exe
cd C:\xampp\xampp\php
%PHP_COMMAND% "%YII_PATH%yiic" %*
@endlocal

Is this wrong??
Hope for help
/Christer
0

#3 User is offline   Angelo 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 25
  • Joined: 19-June 09
  • Location:Nanaimo, BC CAN

Posted 14 November 2010 - 01:15 AM

View PostOtto, on 02 November 2010 - 04:29 AM, said:

Hi!
I think I do exactly the way you discribe.
I still have the same error.
After editing the bat-file it look like this:

@setlocal
set YII_PATH=%~dp0
if "%PHP_COMMAND%" == "" set PHP_COMMAND=php.exe
cd C:\xampp\xampp\php
%PHP_COMMAND% "%YII_PATH%yiic" %*
@endlocal

Is this wrong??
Hope for help
/Christer


i had the same issues as you. The only way it worked was to include the path to the php.exe in the environment variables and in the command prompt (from anywhere)

php path\to\framework\directory\yiic.php webapp path\to\www (for example. php c:\wamp\framework\yiic.php webapp c:\wamp\www\myapp

I used this with wamp 2.0/windows 7

Hope that helps
0

#4 User is offline   Antonio Ramirez 

  • Elite Member
  • Yii
  • Group: Yii Dev Team
  • Posts: 1,448
  • Joined: 04-October 10

Posted 14 November 2010 - 03:40 AM

Hi all, I think this is the perfect content for a WIKI article... Anyone?

Once registered, anybody can write one and I think is great content
┬┐How long would it take for you to understand that you own nothing in this world?

www.ramirezcobos.com
www.2amigos.us
www.github.com/tonydspaniard
www.github.com/2amigos


Posted Image
0

#5 User is offline   Adam Lofting 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 22-January 12
  • Location:UK

Posted 22 January 2012 - 09:34 AM

View PostAntonio Ramirez, on 14 November 2010 - 03:40 AM, said:

Hi all, I think this is the perfect content for a WIKI article... Anyone?

Once registered, anybody can write one and I think is great content


Hi, I'm just getting started with Yii and this thread helped me past the first stumbling block so I'll have a go at writing this up as a wiki article.
0

#6 User is offline   Adam Lofting 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 22-January 12
  • Location:UK

Posted 22 January 2012 - 09:42 AM

Sadly I'm 'too new' to write a wiki article, but here is my collated version of this thread in case someone else can copy and paste it into the wiki.

Using yiic on Windows - PHP is not recognised

Step 1: Edit the yiic.bat file.
Located \YiiPath\framework\yiic.bat

find the path where php.exe resides on your disk, and add the line
cd C:\Program Files\PHPexeFolder\
above
%PHP_COMMAND% "%YII_PATH%yiic" %*

Step 2: Add the PHP path to the system variables.
Right click "my computer" go to "system properties" under "advanced" tab, click on "environment variables"
Under "system variables" find for the variable named "PATH" and click on "Edit" button
in "Variable Value" append the php.exe path with a semi-colon to the end of current string like below (without the inverted commas)
";C:\Program Files\PHPexeFolder\"

Step 3: Open command prompt, run the following with paths beginning with your drive letter e.g. C:\

php C:\path\to\framework\directory\yiic.php webapp C:\path\to\newwebappfolder (for example. php c:\wamp\framework\yiic.php webapp c:\wamp\www\myapp

Sources: This article is a quick write-up of a forum thread:
http://www.yiiframew...ternal-command/

Further reading: Yii and XAMPP server on Windows
http://www.yiiframew...rver-on-windows
0

#7 User is offline   zubo 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 7
  • Joined: 11-May 11

Posted 18 February 2012 - 02:44 AM

Let me add a much simpler way.. At least for me...

Look at the paragraph in this link Larry explains it REALLY well and the whole free guide is worth following...

http://www.larryullm...ework/#more-563

So search for where php.exe is on our system... In my case it was c:/php

Then in the directory where yiic is type c:/php/php.exe yiic webdev and bingo the site is created....


Superb

George
0

#8 User is offline   Jimako 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 6
  • Joined: 23-January 12
  • Location:Slovak Republic

Posted 19 February 2012 - 05:53 AM

Hi, I had the same problem. I had to write in shell:

cd C:\ComplexWebServer/http_docs
"C:\ComplexWebServer\php5\bin\php.exe" YiiMain/framework/yiic.php webapp demo

ComplexWebServer was my software like xampp. Later I had problem with installing phpunit, so I changed it to xampp and everything worked (I found that paths to php.ini in "$ php --ini" and phpinfo are different in my old software and nothing helped)

But I found really good idea how to create application in Yii.
In http_docs create file generator.bat. Insert code (f.e.):
"C:\ComplexWebServer\php5\bin\php.exe" YiiMain/framework/yiic.php webapp demo 

Then only click on this file in folder. I only changed name of aplication every time, then clicked and everything worked.

It's not my idea, I found in YTB tutorial (It's propably Spanish, I watched only video - www.youtube.com/watch?v=tDPyQSFcq98)
But because I haven't problem with paths, I use shell now.
0

#9 User is online   soulgears 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 8
  • Joined: 20-December 11
  • Location:Indonesia

Posted 21 February 2012 - 08:04 AM

on path windows
environment variables on
%path%;C:\xampp\php\;D:\wwwroot\yiiframework\


on cmd.exe
D:\wwwroot>yiic webapp myblogyii


i hope working
0

#10 User is offline   Celso Soares 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 06-March 13

Posted 06 March 2013 - 11:57 AM

I had all this problems too, and i found a great solution for who are using Xammp/Windows:

in cmd.exe

1 step
c:\> cd xampp\htdocs\yii\framework //the path where you have the yii framework
2 step
c:\xampp\htdocs\yii\framework> c:\xampp\php\php.exe yiic webapp c:\xampp\htdocs\yourappname
3 step
Ask if you want create the app and you write "yes"

app created!

i hope this helps!
0

#11 User is offline   jacmoe 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 2,601
  • Joined: 10-October 10
  • Location:Denmark

Posted 06 March 2013 - 12:04 PM

This is not really a "great" solution. :)

It works, but it's far better to add the path to the php client executable and the path to yiic (in yii/framework) to your PATH environment variable.

It's no big deal. ;)
"Less noise - more signal"
0

#12 User is offline   Priyranjan Singh 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 4
  • Joined: 10-April 13
  • Location:Kolkata, India

Posted 12 April 2013 - 10:41 PM

Second method helped. First method did not. Thanks .
0

#13 User is offline   jacmoe 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 2,601
  • Joined: 10-October 10
  • Location:Denmark

Posted 13 April 2013 - 03:05 AM

Indeed.
And the second method is what is recommended that you do. :)
"Less noise - more signal"
0

#14 User is offline   Mahrizal 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 24-September 12

Posted 26 April 2013 - 10:37 AM

@soulgers : Thanks it works for me
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

2 User(s) are reading this topic
0 members, 2 guests, 0 anonymous users