delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/05/09/22:57:12

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
From: Sam Edge <sam_edgeZZZ AT hotmail DOT com>
To: cygwin AT cygwin DOT com
Subject: Cygwin/Apache with PHP CGI
Date: Fri, 10 May 2002 03:56:49 +0100
Organization: .
Reply-To: cygwin AT cygwin DOT com
Message-ID: <jhbmduobaj4da5uoec9f64e3tu0427qgbm@4ax.com>
References: <01ufduo7c330fgmratp0qgfrgqkdv7upa8 AT 4ax DOT com> <3CD92533 DOT 9B0A0147 AT wapme-systems DOT de> <r9didu847jsnm4qhbr3gl87muukivim0e5 AT 4ax DOT com> <71hidu8lr0qssqnne37377r6aac6t40l8n AT 4ax DOT com> <3CDA53EC DOT D3866B26 AT wapme-systems DOT de> <88dldugtt8sfdql1r3inb85uq47frqnuqu AT 4ax DOT com> <27uldusi9241b01mgf37qocmsq6k71hud4 AT 4ax DOT com>
In-Reply-To: <27uldusi9241b01mgf37qocmsq6k71hud4@4ax.com>
MIME-Version: 1.0
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id g4A2vCr08796

Further to my problems with the Apache PHP module package I've given
up for the moment.

Instead I've downloaded the latest 4.2.0 Win32 native PHP ZIP file and
unzipped this into its own directory.

I've then made sure php-cli.exe, sapi\php.exe and php4ts.dll are in my
Windows PATH and copied php.ini-recommended to C:\WINNT\php.ini to get
the command line PHP working.

Finally, to use this from Cygwin/Apache I've commented out the PHP
LoadModule and AddModule lines and created a cgi-bin shell script to
run PHP via an Action line in htppd.conf.

httpd.conf:
	...
	#LoadModule php4_module lib/apache/libphp4.dll
	...
	#AddModule mod_php4.c
	...
	AddType application/x-httpd-php .php
	Action application/x-httpd-php "/cgi-bin/php-cgi"
	...

/var/www/cgi-bin/php-cgi: (or wherever your cgi-bin actually lives)
	#!/bin/sh
	export PATH="/bin:$PATH"
	win_page=`cygpath -w "$PATH_TRANSLATED"`
	export PATH_TRANSLATED="$win_page"
	php 2>&1

The crucial bit is converting PATH_TRANSLATED from Cygwin/Posix format
to Windows native for PHP.EXE to read.

Your PHP script will have to be written with the Windows native filing
system in mind so there are a few other variables that might benefit
from translation too if your script uses them. Cygwin is automatically
translating PATH but DOCUMENT_ROOT and SCRIPT_FILENAME might be needed
too. (Although I can't think why.)

(I appreciate that CGI is a sub-optimal way of using PHP in Apache but
at least this /is/ working for me and allows me to check my code more
easily before uploading to my service provider's Apache/PHP server.)

-- 
Sam Edge

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019