Hello,
        I am running the module version of php(4.0.5) AND have a cgi
version compiled.  The cgi version is php 4.1.1(compiled with
--enable-discard-path) and this is on a sunOS 5.8 box. I am trying to run
a setuid wrapper that calls a .php4 script.  Whenever I enter
the url to the .cgi wrapper it appears to echo the binary as opposed to
executing it?  If I execute the cgi from the command line it
works fine.  Also if I change the file that the cgi wrapper is pointing to
to a .sh file it runs fine via command line or a url
through apache.  If I enter the url directly to the .php4 in the url it
works and is parsed by the cgi version of php.  Because of
these symptoms I beleive it has something to do with my apache
configuration?  However below I am pasteing the cgi wrapper code,
the apache configuration, and the unf.php4 file that the wrapper points
to.  I hope that someone will be kind enough to
help me out.

//cgi wrapper after gcc i would then chmod 4755.
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
int main(void){
        setuid(1001);
        setgid(10);
system("/path/to/cgi-bin/unf.php4");
}


//I have tried many different types of configurations with the following
apache directives.
//my current settings that should be relevant are below.

AddHandler cgi-script .cgi .pl
Action application/x-httpd-php /usr/local/bin/php
AddType application/x-httpd-php .php .php4

//then where the virtual host is defined I have this.
//i have replaced the directory path and real domain name with
/path/to/mydomain

<VirtualHost www.mydomain.com>
    <Directory "/path/to/mydomain/public_html/cgi-bin">
        AllowOverride None
        Options ExecCGI
        Order allow,deny
        Allow from all
    </Directory>
    ScriptAlias /cgi-bin/ "/path/to/mydomain/public_html/cgi-bin/"
    ServerAdmin [EMAIL PROTECTED]
    DocumentRoot /path/to/mydomain/public_html
    ServerName www.mydomain.com
    ErrorLog /path/to/mydomain/public_html/logs/error_log
    CustomLog /path/to/mydomain/public_html/logs/access_log common
</VirtualHost>


//finally I will post the code to the unf.php4 file that is being called
by the wrapper
//removing the -q has no effect


#!/usr/local/bin/php -q
<?
echo "got here";
system('id');
?>


ive looked all over for an answer to this problem, google, php.net
devshed.com phpbuilder, #php on efnet and openprojects.net, php-general
list, you guys are my last resort.  So if no one can help could someone
give me some other places where i can try to get help for this
problem? Thank you in advance.

~serj


-- 
PHP Install Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to