Search Marketing

   
   

Command Line PHP - Installing PHPcli

Mon Nov 17, 2008 6:46 pm
    >>
Comments: 0 Views: 854

Installing PHP-cli is very easy with apt-get.

# apt-get install php5-cli

Once you have installed php5-cli, you simply create a document.

# pico test

# chmod +x test

chmod +x allows the file to be executable.

Then put the following in and save the file.

#! /usr/bin/php


$date = time();

echo $date;

?>

Line 1 (#! /usr/bin/php) is very important, it tells the script where the preprocessor is.

To run this file you type in:

# ./test

If you script does not work, it could possibly be that you getting the location wrong.

One way to tell where your php is located is to run:

# find /var | grep php

or

# find /usr | grep php

Most likely php is somewhere under those directories.



Comments
Name:
*
URL: http: (ex. cnn.com)
Comment:
*
Number:
Math (16 + 5)
* required

© 2019 Christonium LLC

Christonium.com
|
Terms of Use
|
Privacy
ccc