Results 1 to 7 of 7

Thread: [RESOLVED] PHP CLI - Testing if I have one????

  1. #1

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190

    Resolved [RESOLVED] PHP CLI - Testing if I have one????

    This is so no my area...but I was toled to do these two steps.

    f) PHP compiled as Apache module, including MySQL support.
    Tested mainly with PHP version 4.3.0 and above. (Note that if
    you are compiling mod_php from source, it is good to compile
    it against the same MySQL client library as mod_python, so
    that the two Apache modules are using the same MySQL client
    library. We saw Apache/PHP/Python problems in the past when
    they weren't.)
    <http://www.php.net/>

    g) PHP compiled as a standalone command-line executable (CLI)
    (in addition to Apache module) is required, too. As of PHP
    4.3.0 you'll obtain the CLI executable by default, so you
    don't have to compile it separately. Note that PHP CLI should
    be compiled with the process control support (--enable-pcntl)
    and the compression library (--with-zlib).
    <http://www.php.net/manual/en/install.commandline.php>
    <http://www.php.net/manual/en/ref.pcntl.php>

    I first did the first one (at least I think), and I made a script like this:

    PHP Code:
    <?php phpinfo(); ?>
    and the PHP thingy came up. So I guess that is working. But I am not 100% sure how to test the second thingy. I didn't do anything more, because I installed PHP 4.4, so I am not sure if I even need to do anything more. I wrote this little thing:

    PHP Code:
    <?php
    echo exec('whoami');
    ?>
    And it outputted "nobody". Does that mean that I have it all up and running. Or is there an other test I should try just to be sure?

    Thanks
    - ØØ -

  2. #2
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906

    Re: PHP CLI - Testing if I have one????

    Well done, you now have working PHP DSO module
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

  3. #3

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190

    Re: PHP CLI - Testing if I have one????

    woohoo....but am I sure that I have a compiled CLI too?

  4. #4
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906

    Re: PHP CLI - Testing if I have one????

    You should have the php cli in the source directory (after compilation) in a sub directory called CLI. You can then copy it to /usr/local/bin and you can runs scripts from the command line
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

  5. #5

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190

    Re: PHP CLI - Testing if I have one????

    Hmmm...what? I have this in the cli folder:

    PCDSUSI02:/home/noteme/mydoc/apps/php-4.4.0/sapi/cli# les
    totalt 5108
    drwxr-xr-x 3 noteme noteme 4096 2005-07-28 10:57 .
    drwxr-xr-x 20 noteme noteme 4096 2005-07-11 10:07 ..
    -rw-r--r-- 1 noteme noteme 1628 2003-12-01 16:12 config.m4
    -rw-r--r-- 1 noteme noteme 36 2002-09-27 12:15 CREDITS
    -rw-r--r-- 1 noteme noteme 4238 2003-05-31 02:20 getopt.c
    -rw-r--r-- 1 root root 51408 2005-07-28 10:57 getopt.lo
    drwxr-xr-x 2 root root 4096 2005-07-28 10:57 .libs
    -rw-r--r-- 1 noteme noteme 379 2003-02-12 04:39 Makefile.frag
    -rwxr-xr-x 1 root root 4970442 2005-07-28 10:57 php
    -rw-r--r-- 1 root root 5522 2005-07-28 10:40 php.1
    -rw-r--r-- 1 noteme noteme 5530 2005-04-30 04:12 php.1.in
    -rw-r--r-- 1 noteme noteme 24265 2005-03-22 15:09 php_cli.c
    -rw-r--r-- 1 root root 95144 2005-07-28 10:57 php_cli.lo
    -rw-r--r-- 1 noteme noteme 1591 2003-05-31 02:20 php_getopt.h
    -rw-r--r-- 1 noteme noteme 781 2003-05-31 01:37 README
    -rw-r--r-- 1 noteme noteme 6 2003-04-09 20:27 TODO
    Is it the "php" file? I tried to run it, and then nothing happend..not even sure how to get out of it..

    And how is it possible to run PHP code in a console window? It can't show images and so on..


    Sample run..

    PCDSUSI02:/home/noteme/mydoc/apps/php-4.4.0/sapi/cli# php

    echo 'hello'

    ^[
    exit
    logout
    boooooo
    ;

    echo "hello";
    <?php echo "hello"; >
    And I have no idea how to get out of this, except closing the console window...

    - ØØ -

  6. #6
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906

    Re: PHP CLI - Testing if I have one????

    Type Control-D. PHP takes a file as input and Control-D simulates EOF on a UNIX computer.

    After copying the binary called php to a directory in the system path i.e: /usr/local/root you can execute PHP scripts in one of two ways:
    Code:
    #php /path/to/file.php
    Or add the following line to the top of your PHP script and make it execuatable:
    Code:
    #!/usr/local/bin/php
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

  7. #7

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190

    Re: PHP CLI - Testing if I have one????

    w00t...I all ready tried Ctr+D, that is what I am using for the Python Intepreter...guess I must have pressed the wrong key..I should really try to pay attention to what I press..


    Thanks a bunch..


    - ØØ -

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width