Posts Tagged cgi

Calling a CGI Script from PHP

For any given weird, seemingly pointless action, you will be able to find at least 3 good, interesting reasons for wanting to take that action (provided you look around hard enough). In my case, the action was calling a cgi script from php, and the reason was to implement a good logging system. I run a bugzilla installation here, and I didn’t want to go editing every page to get a logger. I also didn’t want to use Apache’s own loggers, since a MySQL database is much easier to handle than a super-sized file.

My solution was to create an index.php file and modify the htaccess so that every request to the bugzilla installation went through index.php. Then, I could have index.php log the event, and call the appropriate cgi script.

Read the rest of this entry »

Tags: , , , , , , ,

1 Comment

Causes of Lighttpd 403 Forbidden

On a fresh installation of lighttpd (which I chose instead of Apache because the server was dreadfully old and slow), I discovered that although html and other client-side files worked fine, trying to browse php and cgi files resulted in a “403 Forbidden” message. Being an Apache veteran, I checked the htaccess (there was none), made sure the permissions were properly set (world-readable), and looked through the config file to make sure I had gotten rid of all of the lines that instructed the server to return 403 on .php requests (I had had a problem with those in Apache once). Nothing. I checked the error log – nothing noteworthy.

I next checked to make sure the modules were being loaded. Well, the instruction to load the modules was right there:

server.modules = (
            "mod_access",
            "mod_alias",
            "mod_accesslog",
            "mod_compress",
            "mod_fastcgi",
#           "mod_rewrite",
#           "mod_redirect",
#           "mod_evhost",
#           "mod_usertrack",
#           "mod_rrdtool",
#           "mod_webdav",
#           "mod_expire",
#           "mod_flv_streaming",
#           "mod_evasive"
)

Later on in the file, I found instructions to load php via fast-cgi:

static-file.exclude-extensions = ( ".php", ".pl", ".fcgi",".cgi")

The ultimate solution was trivial. Lighttpd apparently has pretty bad error reporting – the modules were not, in fact, being loaded. I had to move the appropriate files from /etc/lighttpd/conf-available to /etc/lighttpd/conf-enabled.

Tags: , , , , ,

No Comments