Iworx default user PHP setup question

I was trying to seup cron with PHP on another server non-Iworx. On my Iworx server I can do this from command line.

php -q script.php.

And I was pretty sure the PHP on Iworx boxes as Apache module and not CGI. So then I decided to compare the phpinfo() from the 2 different servers.

Iworx: Apache 2.0 Handler
Other: Apache
Doing a php -v on the Iworx shell I get “PHP 4.3.11 (cgi)” (dont have SSH access to the other server)

Running the cron on the other server as php -q does nothing so I am just gonna try to run it through lynx, but it just got me thinking how is Iworx PHP for users setup by default?

Php is setup as cgi in /usr/bin/php

But i’m not sure to understand your question

On the other box php -v should give php-cli or php-cgi…

Maybe try to route the error to a file by doing
php -q myfile 2> /logfile

Pascal

Justin, type

locate php

to find the location of the php binary (probably /usr/bin/php) then replace php with the exact path to php and that should work. I’m not sure where the listing is to specify just php leading to the path to the binary.

/usr/bin/php -q script.php

use locate if your locate BD is updated if not try
which php

Pascal

[quote=pascal;10255]use locate if your locate BD is updated if not try
which php

Pascal[/quote]

yep, though the locate database update is normally run on your daily cron, but then again if the php shortcut doesn’t work then it makes sense that it might not be. Thanks Pascal. :slight_smile:

[QUOTE=IWorx-Tim;10253]Justin, type

locate php

to find the location of the php binary (probably /usr/bin/php) then replace php with the exact path to php and that should work. I’m not sure where the listing is to specify just php leading to the path to the binary.

/usr/bin/php -q script.php[/QUOTE]

On a webserver you’ll get a few thousand results by doing that (at least if anyone has any php scripts, and/or you have phpmyadmin installed)

Use whereis php – this gives you more than which php, which only gives you the binaries. whereis gives you libraries and other related files too :slight_smile:
(Don’t include the two – marks as the command though!)

Basically my question was I was confused on the PHP install on Iworx box. I always believe the PHP on Iworx box was an apache module and not CGI. If its CGI then you can run php -q whatever which I have been able to do from SSH on my Iworx server.

Also, PHPinfo() for the module on the Iworx box isn’t CGI, but rather “Apache 2.0 Handler” and I’m exactly sure what that means. Just the same as Apache, but for 2.0??

The other box says just “Apache” which makes sense that it is install as an apache module.

So to sum up my questions:

  1. If Iworx is an Apache module…
    a. why does /php -q myscript.php run on my Iworx box?
    b. why does php -v give me a CGI version -> PHP 4.3.11 (cgi)

  2. How does Apache 2.0 Handler compare to Apache?

Hi Justec,

By default, both the CGI/CLI module (in /usr/bin/php) and the PHP module (in /usr/lib/httpd/modules/libphp4.so) are installed. So depending on how PHP is run, you will either get “CGI” or “Apache 2.0 Handler”. There are three ways you can see phpinfo() results:

[LIST=1]

  • From the command line, running "php -i". This will obviously use /usr/bin/php which will report the Server API as "CGI". Similarly, running "php -v" from the command line will tell you that it's CGI.
  • Creating a test file on a site on the server, with the contents:
    <?php
    phpinfo()
    ?>
    

    then browse to that page, and you will see Server API as “Apache 2.0 Handler”, indicating php is being run as an apache module.

  • Clicking the "PHP Info" link in NodeWorx under "System Services -> Web Server -> PHP Information". All we do here, in the NodeWorx code, is echo out the result of running "php -qi". As such, "Server API" reports "CGI" [/LIST]

    Hopefully that clears things up. :slight_smile:

  • Yes, that clears it up… Short answer is BOTH :stuck_out_tongue:

    I had run all the things you mentioned and thats how I got confused.

    So basically my server has PHP as a CGI as well as an apache module. It runs in apache as a module, but the CGI is still available from command line. The other non-iworx server must have PHP compiled only as an apache module.