[users@httpd] Understanding suexec error with Apache 1.3.34 and PHP 4

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

I'm trying to get suexec running with php4 and a site full of .php pages running on a Mac OS X 10.3.9 machine. I was experiencing silent failures of suexec (no entry in the /var/log/httpd/{suexec_log,error_log} files) so I eventually found the c source code that I am pretty certain contains my problem (apache_1.3.34/src/main/util_script.c). I added fprintf calls to this source file and discovered that the conditional I have quoted below was failing, and therefore apache was not running my script via the suexec executable. The part of the conditional that is giving me trouble is "(!strncmp("/~", r->uri, 2))", which I believe checks to see if the request is for a user file (the other checks are first to see if suexec is even enabled, and then secondly to see if the request is for a virtualhost configured to run as a different user than the apache server.) I want to serve files from the user space for "csg" with an effective uid of "csg", but the problem appears to be this: r->uri is: /CGI-Executables/php4/~csg/csg/Index.php (which I understand is the CGI method of processing the file /~csg/csg/Index.php with the executable /CGI-Executables/php4 (which is /Library/WebServer/CGI-Executables/php4 in terms of my filesystem)), and because this uri does not begin with "/~", suexec does not run on it.

/* util_script.c */
/* excerpted from approximately line 1140 */

/* Begin CSG Edit */
const char *testFilePath = "/var/tmp/CarlApacheText.txt"
testFile = fopen ( testFilePath, "a" );
fprintf ( testFile, "Introduction 2\nap_suexec_enabled\t%i\nserver_uid\t%i\nserver_gid\t%i\nap_user_id\t%i \nap_group_id\t%i\nuri\t%s\n\n", ap_suexec_enabled, r->server->server_uid, r->server->server_gid, ap_user_id, ap_group_id, r->uri );
fclose ( testFile );
/* End CSG Edit */

    if (ap_suexec_enabled
	&& ((r->server->server_uid != ap_user_id)
	    || (r->server->server_gid != ap_group_id)
	    || (!strncmp("/~", r->uri, 2)))) {
		/* perform more checks and then run as suexec */
	} else {
		/* don't run as suexec */
	}

The output of the fprintf above is:

/* /var/tmp/CarlApacheText.txt */
Introduction 2
ap_suexec_enabled       1
server_uid      70
server_gid      70
ap_user_id      70
ap_group_id     70
uri     /CGI-Executables/php4/~csg/csg/Index.php

Perhaps I am running php4 incorrectly: presently I run php4 using the following httpd.conf and .htaccess directives:

/* httpd.conf */

<Directory /Users/csg/Sites/csg/>
    AllowOverride All
</Directory>

/* .htaccess */

AddType application/x-httpd-php php
Action application/x-httpd-php /CGI-Executables/php4

So in summary, I think I need to configure my apache to be serving a uri beginning with "/~", but I thought that the way to use php4 in cgi mode was to have the executable in the apache server's webspace, and that requests for personal files, e.g. /~csg/csg/Index.php, get translated to /CGI-Executables/php4/~csg/csg/Index.php. Thank you very much for any help.

-Carl


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
  "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux