php-switch can't find phpcli

Problems with the Windows version of XAMPP, questions, comments, and anything related.

php-switch can't find phpcli

Postby natcolley » 08. January 2008 00:37

Hello. This is my first post. I do not speak German so I am using Google Translate in hopes of getting more responses. I just downloaded xampp 1.6.5, everything seems fine, except the php switch. Since I only got xampp for php 4, this is a huge problem. When I run php-switch.bat from the command line this is the error I get:
Sorry...cannot find php cli!

phpcli.exe is in xampp\php\php4. I assume that is where it is supposed to be so I don't know why php-switch.bat can't find it. php-switch.php is in \xampp.
Apache is stopped. All help appreciated.

Hallo. Dies ist mein erster Post. Ich spreche kein Deutsch, so bin ich mit Google Übersetzen, in der Hoffnung, noch mehr Antworten. I just downloaded xampp 1.6.5, scheint alles gut, mit Ausnahme der php-Schalter. Da ich nur noch xampp für PHP 4, das ist ein riesiges Problem. Wenn ich php-switch.bat von der Befehlszeile aus dieser ist der Fehler bekomme ich:
Sorry ... nicht finden können, php cli!

Phpcli.exe ist in xampp \ php \ php4. Ich gehe davon aus, dass es, wo es sein soll und ich weiß nicht, warum php-switch.bat kann sie nicht finden. Php-switch.php ist in \ xampp. Apache ist gestoppt. Jede Hilfe dankbar.
natcolley
 
Posts: 11
Joined: 07. January 2008 23:51

Postby Izzy » 08. January 2008 02:52

Vista requires that most command line files need to be run as an administrator.

Try right clicking on the php-switch.bat file and selecting from the presented context menu to Run As Administrator and paste back here the full error message if you get any or select 4 if prompted to do so to switch to php4.

Other than that I am afraid I have no clues for you other than you may have a corrupted installation that would need to be uninstalled as per the xampp\readme-en.txt file and then installed again using the instructions contained in this page:

http://www.apachefriends.org/en/xampp-windows.html

There is a permissions issue in Vista installing XAMPP to a directory with a space in the name, also pointed out in the Vista Note in the above web page - C:\Program Files\xampp for example.
Best practice is to install to the root directory of a hard drive or partition - C:\xampp or x:\myfiles\xampp for example (x = any drive letter).
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06

Postby natcolley » 08. January 2008 03:49

I'm not using Vista. This is Windows 2003. Right clicking php-switch.bat does not give me any run-as option. I am the only admin on this box. The readme says I can install from any directory. In this case that would be c:\download, and it did set up the files in c:\xampp, but I am going to reinstall from c:\ and see what happens.
natcolley
 
Posts: 11
Joined: 07. January 2008 23:51

Postby Izzy » 08. January 2008 04:00

Yes, it always helps if you provide full details for us to work with otherwise we can only take a guess at a solution.

Your problem indicated a permission or a path issue - permissions are usually a Vista problem and a path issue is usually an XAMPP installation problem.

Remember to install using the correct method outlined in the web page link above especially with regard to running the setup_xampp.bat file that sets all the correct paths for you after installation.

You should install XAMPP to only one directory as multiple installations will cause path problems.

BTW XAMPP should work "out of the box" for most, if installed correctly, on a trouble free OS.

When uninstalling, first make sure you have stopped all running XAMPP modules and uninstalled any XAMPP services you may have installed, then you can delete the xampp directory.
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06

Postby natcolley » 08. January 2008 05:11

I used the installer both times. And I decided to run setup_xampp.bat just now to see if that would help or make a difference, and I got EXACTLY the same error -
Sorry...cannot find php cli!
Does it make sense that I would get the same error for these two different commands? What if I just copied or moved phpcli.exe to c:\xampp?
natcolley
 
Posts: 11
Joined: 07. January 2008 23:51

Postby Izzy » 08. January 2008 06:24

You have a path issue.

The error message just says Sorry...cannot find php cli!
It does not say it can't find phpcli.exe - so copying that file to the C:\xampp directory will not solve your problem.

Lets take a look at how you are receiving this error as I have been able to replicate it by simply renaming the C:\xampp\php directory to C:\xampp\phpren - it produced the Sorry...cannot find php cli! error.

The php-switch.bat file when I open for edit in a text editor contains this relevant bit of code:
if exist php\php.exe GOTO Normal
if not exist php\php.exe GOTO Abort

:Abort
echo Sorry ... cannot find php cli!
echo Must abort these process!
pause
GOTO END

So you see quite clearly that it is looking for php.exe in the C:\xampp\php directory not a phpcli.exe file

So if php\php.exe exists go to Normal - so in your case and in my case the php\php.exe did not exists and went to Abort and gave us the error.

The path to php\php.exe is relative to the php-switch.bat file.

So if the php-switch.bat file is in C:\xampp\php-switch.bat
And if the php\php.exe file is in C:\xampp\php\php.exe and the batch file finds it there then the batch file will go to Normal and proceed to offer us a php switch but if the batch file can't find it, then it will go to Abort and give the error message we both received.

Having explained that to the best of my ability and been able to replicate your error then it is up you now to see why you are getting the error based on my explanation on your XAMPP installation.


The other possibility is that you have had another php installation or still do and the Windows environment path is sending requests to it perhaps or, after installing XAMPP a reboot may be required to have the C:\xampp path recognized.

To check your Windows paths and edit them to include the C:\xampp\php path go here:
(I have only XP but one would assume that your OS would be similar)

Open the Windows Control Panel
Click on System->Advanced->Environment Variables

There are 2 path locations
User variables->PATH
System variables->Path

Click on Edit on both of these and add at the beginning
C:\xampp;C:\xampp\php;

Click OK Click OK Click OK

Then try again to run the batch file - you may have to reboot your computer to have the new paths recognized.
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06

Postby natcolley » 08. January 2008 07:28

I was sure you were right because I found some old php in the path and took that out and put in xampp as you suggested and rebooted, but i still get the same error :cry:
natcolley
 
Posts: 11
Joined: 07. January 2008 23:51

Postby Izzy » 08. January 2008 08:09

OK, lets go to the beginning and do some sort of check list.

You installed XAMPP according to the instructions and you are happy the installations went according to plan?

You ran C:\xampp\xampp-portcheck.exe to make sure that no other programs were using the ports that XAMPP requires exclusively? - all ports were showing Free.

You started Apache and MySQL using the start batch files to check if they started without errors?

No errors so you stopped Apache and MySQL using the stop bat files?

You started Apache and MySQL using the XAMPP Control Panel?

They both showed as Running in the CP?

You typed http://localhost in your browser and then what happened?

You then proceeded to test all the menu items in the XAMPP Welcome page and had no errors at all with any of them?

You typed http://localhoat/xampp/phpinfo.php in your browser and checked that all the paths were correct according to your XAMPP installation and nothing php related looked out of order?

You then ran the php swap batch file and met with the error. :?:
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06

Postby natcolley » 08. January 2008 09:07

Izzy wrote:OK, lets go to the beginning and do some sort of check list.

You installed XAMPP according to the instructions and you are happy the installations went according to plan?

Code: Select all
 Yes. I used the windows installer because I'm new at coding and I always have some kind of trouble with manual installs. But it looks ok, except for this issue.


You ran C:\xampp\xampp-portcheck.exe to make sure that no other programs were using the ports that XAMPP requires exclusively? - all ports were showing Free.

Code: Select all
No, but I'll do that now....
It won't let me cut and paste, but the results are:
Apache 80 http       c:\windows\system32\svchost.exe
Apache 81 webdav  free
Apache 443 https    c:\windows\system32\svchost.exe

mysql  3306  c:\xampp\mysql\bin\mysqld-nt.exe

filezilla both free

Mercury Mail snmp 25  c:\windows\system32\inetserv\inetinfo.exe
pop and imap free (edit - I just checked. I see the sample email I sent from xampp during installation has not arrived although the set up said it went well)

I have iis running another website on this server. I was going to use xampp to work on bringing a php 4 program up to php 5.



You started Apache and MySQL using the start batch files to check if they started without errors?
Code: Select all
 No, I was using either the xampp control panel or the service control manager. Just now Apache stops with the batch file but does not start and does not give an error. Starting it with the service control manager gives the 1 error, which i know from past experience is because of iis. But the xampp html comes up in localhost.

No errors so you stopped Apache and MySQL using the stop bat files?
Code: Select all
 Again, no, I was heretofore using the xampp control panel. But yes, I stopped apache, not mysql.

You started Apache and MySQL using the XAMPP Control Panel?
Code: Select all
 affirmative

They both showed as Running in the CP?
Code: Select all
affirmative

You typed http://localhost in your browser and then what happened?
Code: Select all
 I got the xampp html page. It's orange and has all the links down the side, including php switch. The links work.


You then proceeded to test all the menu items in the XAMPP Welcome page and had no errors at all with any of them?
Code: Select all
right

You typed http://localhoat/xampp/phpinfo.php in your browser and checked that all the paths were correct according to your XAMPP installation and nothing php related looked out of order?
Code: Select all
everything looks great there. I do still see one of the old stacks that had php in the path. I thought I deleted that. I'll go back and try that again when I finish this checklist.

You then ran the php swap batch file and met with the error. :?:
Code: Select all
correct

Code: Select all
 edit - ok, I edited the path again, rebooted, ran switch, same error  :cry:
natcolley
 
Posts: 11
Joined: 07. January 2008 23:51

Postby Izzy » 08. January 2008 09:55

Houston, we have a problem.
Izzy wrote:You ran C:\xampp\xampp-portcheck.exe to make sure that no other programs were using the ports that XAMPP requires exclusively? - all ports were showing Free.

This is a must as there is something else using port 80 and port 443

smtp is still using IIS

You have to sort this out so with no XAMPP modules running all ports are Free.

It looks like you have some services running that need to be uninstalled before you go much further as you really need to have a clean start for XAMPP - check that you have disabled IIS - inetserv.

Look in the Services Manager from your Administrator Tools->Services

Let me know if you know not how to disable a service.

You can also check what process are currently running by right clicking on the Task Bar and selecting Task Manager->Processes.

There should be no apache or mysqld processes running when you have stopped them all using your XAMPP CP or the batch files.
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06

Postby natcolley » 08. January 2008 09:59

Ok. Thank you so much. This has been one of the most helpful and immediate responses I've ever gotten on a forum like this, so I want you to know I appreciate it. But it is 3am here. I am going to bed now. I will tackle this in the morn... uh, when I get up. ;-)
natcolley
 
Posts: 11
Joined: 07. January 2008 23:51

Postby Izzy » 08. January 2008 10:07

OK - sleep well.

When you wake you have to disable IIS for now to test that XAMPP is working correctly as you can't run both at the same time using the same ports - just not possible.

Once you have disabled IIS and before starting any XAMPP modules check that all ports XAMPP requires are all Free - don't proceed to do anything until your have them all free.

Then you can start the XAMPP modules you require only like Apache and MySQL, then do your php switch again.

If you want to use IIS also then we have to make some more adjustments to either IIS or Apache so they don't have any port conflicts.

I will be around to-morrow but our time zones a quite different.

TIP - To copy and paste from a Command Console window which is opened by the likes of batch files and xampp-portcheck.exe, click on the tiny icon in the window title bar top left hand side next to the window's title and select from the context menu the Edit item which gives a sub menu with Mark, Copy etc (Mark = select) - also there is a Properties menu item for customizing the way a regular Command Console Window looks and feels.
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06

new day, same error

Postby natcolley » 10. January 2008 03:48

Ok. I turned off iis. I ran port check. all were free except apache on 80 and 443 and mysql. I turned both of those off and ran port check again. all free. I ran php-switch.bat. Got the same error. Suggestions?
natcolley
 
Posts: 11
Joined: 07. January 2008 23:51

Postby Izzy » 10. January 2008 04:36

It has come to light that there may be a bug in XAMPP 1.6.5 which may explain why no matter what we try the result is the same.

See this post:
http://community.apachefriends.org/f/viewtopi ... 485#113485

You may like to add your comment or report your particular issue, after registering of course.

It appears not to be evident in earlier version of XAMPP so it may be prudent to try 1.6.4 or even 1.6.3a - I still use 1.6.3a because of Mod_Perl issues and now I am seeing more bugs in 1.6.5 which I may still hold back on until the developers release a more stable version with an updated Apache version to fix the Perl issue.
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06

Postby natcolley » 10. January 2008 05:54

Thx. I will add my comments. In a way, this is good news. At least I have more options. Good night!
natcolley
 
Posts: 11
Joined: 07. January 2008 23:51

Next

Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 130 guests