PHP5 & .htaccess

software development


I’ve compiled PHP5 just fine on my server and can get it to work. I did the AddHandler and the Action stuff in the .htaccess file and placed it into /home/dkphantasy/ pointing to /cgi-bin/php.cgi.

My only problem is that I have a subdomain that points to /home/dkphantasy/jking/. I have my compiled PHP5 working there, too, but I have to copy over the cgi-bin with php.cgi to that folder too. Is there a way to have both of those pages run off of the same php.cgi, perhaps running it at /home/dkphantasy/cgi-bin/php.cgi instead? I can’t seem to figure out or find out a way to tell the .htaccess files to grab it from there.

I made another copy of php.cgi, put it in /home/dkphantasy/cgi-bin/, and chmodded the folder 755. I tried initially to put a .htaccess file with the php-cgi executable info in /home/dkphantasy/, but / and /jking/ ignored it.

I’ve transferred my website from another host (we didn’t have this much control over our server) and I don’t have the domains transferred over yet. / is located at and /jking/ is located at temporarily until I get the sites set up.


the .htaccess directive has to point to a valid web path for PHP.

You could combine cgi-bin directories have a symlink for both sites that point to it. Or you can have a different directory: cgi-php, which points to a cgi-bin diretory outside the two site paths in which contains your php binary
(follow what I’m saying?)

You can’t, however, symlink the php binary itself. Sucks, I know. I don’t even know if the suggested symlink would work, by you can try it. In theory it should.

What ever the case may be, in order for .htaccess to use it correctly you have to be able to access the physical binary through the web interface: