Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I am currently running Wampserver with multiple PHP versions (5.3.8, 5.4.3). Wampserver easily allows you to switch back and forth between the php version you want apache to use. However, I'm having trouble dealing with multiple versions from the CLI. I have projects that require the command line, but some are compatible with php5.4, while some are not.

Is there a way to create some type of "alias" in Windows that allows me to specify which version of PHP to use on the command line .. I.E: "php54 cache:clear", "php53 cache:clear" ??

Thanks!

share|improve this question

closed as off topic by Michael Hampton, mdpc, Ward, Jay, Khaled Mar 26 '13 at 12:34

Questions on Server Fault are expected to relate to server, networking, or related infrastructure administration within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

    
Setting aside the truly horrific nature of what you're doing here for a moment, your question is unclear and possibly overly broad. In the general case, you should be able to refer to the specific version install location and/or binary of PHP you desire to operate on/with that specific version. Is that not working for some reason? –  HopelessN00b Mar 25 '13 at 15:28
    
Why is this such a horrific nature if I may ask? Are you referring to different projects using different versions of PHP? Some of my older client projects have not yet been made compatible with PHP5.4 yet (and their production server is still running php5.3.8), so I must switch to PHP5.3 to perform maintenance on them. Just looking for a shortcut to do this instead of typing the full path "c:\wamp\www\bin\php\php5.4.3\php INSERT CMD HERE" every time I need to run a command. –  Mike Mar 25 '13 at 16:29
    
WAMP, different versions of PHP... PHP in general, doing any of this with cmd.exe... it's all just pretty horrific, frankly. Like trying to run a Linux, IIS, MSSQL, Powershell stack. With different versions of Powershell. From a bash shell. I'm getting PTSD just thinking about it. –  HopelessN00b Mar 25 '13 at 16:46

1 Answer 1

up vote 1 down vote accepted

The easiest way to do this would be to make use of the 'PATH' environmental varibale, and rename the. PHP binaries to be different (if they're not already). Add both PHP install directories into the 'PATH' and they'll both be searched when you run an executable from the command line, so you won't have to type out the full path every time. (Of course, since any directory in there will be searched, it's important you have the different PHP binaries named differently.)

share|improve this answer
    
Thanks.. This is the route I will probably take. I definitely would like some insight on your 'horrific nature' comment though if possible. I am worried there is something I am missing here. –  Mike Mar 25 '13 at 16:42

Not the answer you're looking for? Browse other questions tagged or ask your own question.