Showing posts with label TipsCygwin. Show all posts
Showing posts with label TipsCygwin. Show all posts

Saturday, December 30, 2006

Cygwin Time Zone Part 2

I should have read the warning message carefully. Just like what the message said, my TZ variable was wrong. It was set to:

$ env | grep TZ
TZ=MST7MDT6,M4.1.0/2,M10.5.0/2

Fixed the problem by

$ TZ='US/Mountain'; export TZ

Thursday, December 28, 2006

Installing PHP as CGI on Cygwin

For days of struggling to make PHP work on the Cygwin, I finally figure it out. I've installed Cygwin few years ago and apparently I've tried to install PHP on Cygwin before. Some of my left over setting on httpd.conf was screwing me over and over again for last few days. Here is the left over code:

AddHandler cgi-script .cgi .pl .php

It actually try to run .php file directly, not invoking PHP program. It gave me strange error on /var/log/apache/error_log that

line 1: ?php: No such file or directory

After removing .php extension on AddHandler, I've create php-cgi on /cgi-bin/ directory

#!/bin/sh
export PATH="/bin:$PATH"
win_page=`cygpath -w "$PATH_TRANSLATED"`
export PATH_TRANSLATED="$win_page"
php 2>&1

Found on www.cygwin.com/ml/cygwin/2002-05/msg00591.html via Google Cache. And added following line on httpd.conf file

AddType application/x-httpd-php .php
Action application/x-httpd-php "/cgi-bin/php-cgi"