John
-
Posts
4 -
Joined
-
Last visited
Posts posted by John
-
-
Hello John. For me, using XAMPP on Windows 7, C:\xampp\php\php -v works.
HI Larry,
Thanks for the reply.
Finally got it going with C:\xampp\php in the path...
C:\xampp\php>php -v
PHP 5.3.1 (cli) (built: Nov 20 2009 17:26:32)
Copyright © 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright © 1998-2009 Zend Technologies
Discovered I don't have to cd in the cmd line and php -v works now.
H o w e v e r - The following fails...
C:\Users\John>php -r 'echo "Hello, World!";'
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE in Command line
code on line 1
I think you'll recognize that as straight out of the book. To make this short, the final fix was to reverse all the quotes (' for ", " for ')...
C:\Users\John>php -r "print('Hello, World!');"
Hello, World!
This is as far as I've gotten, so I don't know what the status of the other scripts in this chapter is.
Makes no sense to me. Hopefully you'll know why.
Thanks again.
John
-
Hi Antonio,
Hey, John. I can't answer all your questions, but some of them.
- Yes. If you edit the configuration, you need to restart Apache.
Hmm - I was under the impression the the CLI didn't use Apache, but rather a special version of PHP.
- Xampp is very easy to get up and running. (both on Mac and PC - I use both) How about taking a backup of your content, then reinstall xampp?
Xampp has actually been installed twice - the initial, and then an update. It's running just fine.
- Are you using an URL like http://localhost to watch your content? (Standard for Xampp)
Yes.
- Are your web content inside the folder "htdocs" found in xampp?
Yes. It's a standard install.
Sorry if these questions are moronic/a personal insult/etc. Trivial stuff's easy to overlook.
No problems with your questions here. But I am confused by them, as at this point I haven't even started trying to run a script yet - just trying to get a version from the PHP CLI. Also, I see nothing in the book about configuring Apache, but just a mention that the CLI uses a different php.ini than Apache does.
Thanks.
John
-
Hi,
I'm taking an online course that uses your book. My system runs Win 7 with the xampp setup, and actually works very nicely - 'til now.
Trying the initial test (php -v) results in a nasty ''php' is not recognized as an internal or external command,
operable program or batch file.' Missing info in the path statement, I suspect. Tried entering C:\xampp\php\ there, but still got the same result. In \xampp\php\ there is a file 'php-cgi.exe' (nothing that refers to 'cli'). Does this need to be added to the path statement? Also, does the system need a restart for the new path to be recognized?
Needless to say, I'm a Mac guy, but my 9 year old PPC does not support CS5, and also has a very old version of PHP loaded, so I'm pushed to my Win machine. Apologies for my 'Page 1' questions.
Thoughts appreciated.
John
Chapter 11 - Cli
in PHP 5 Advanced: Visual QuickPro Guide (2nd Edition)
Posted
Believe me, I wish I were on my Mac. Unfortunately, it's just an old PPC machine, with most everything no longer supported. So, the box I'm using is running Win 7 Pro.
Interesting to note, I entered the temp conversion script and ran it from the command line without changing any of the quotes. It ran fine! Been in computers as a profession since '65 - mainframe IBMs to Macs. This fits the pattern!
Thanks.
John