Overriding the Interpreter
You can usually specify the PHP interpreter on the first line of your PHP script. Then you can execute the PHP script directly on the command-line. The following example Hello World program uses that feature:
But I found that on some web hosting servers, both PHP 4 and PHP 5 are installed. Usually, /usr/local/bin/php points to PHP 4. My scripts require PHP 5. To change the default location of the PHP 5 interpreter on the first line of the script means I will break the script when I use it on a server where PHP 5 is installed at the default location. The best way, I found, around this problem is to override the first line by specifying the right interpreter on the command-line, as shown below:
Even though the default interpreter is specified on the first line in HelloWorld.php, it is ignored by the executing interpreter on the command-line. Now, I can execute the same script on all servers, once I figure out where PHP 5 is installed.
Did your message disappear? Read the Forums FAQ.
Spam Control | * indicates required field
No TrackBacks yet. TrackBack can be used to link this thread to your weblog, or link your weblog to this thread. In addition, TrackBack can be used as a form of remote commenting. Rather than posting the comment directly on this thread, you can posts it on your own weblog. Then have your weblog sends a TrackBack ping to the TrackBack URL, so that your post would show up here.
Messages, files, and images copyright by respective owners.
19 Users Online
Copyright © 1996 - 2017. All Rights Reserved.