Forum Moderators: coopster

Message Too Old, No Replies

How to use my own PHP parser?

.htaccess with Action does not seem to work

         

jsruok

3:12 pm on May 27, 2004 (gmt 0)

10+ Year Member



My web host's PHP doesn't provide curl, so I want to run .php files thru my own PHP parser. However, I don't want to rename all the .php files into .cgi files and add some #!/path/to/php as the first line.

Is it possible to change the default parser, somehow? So far, I've only tried playing with .htaccess file.

First I wrote


Action php-parser /path/to/php
AddType php-parser .php

and when I tried to access phpinfo.php I got the error message "The requested URL /path/to/php/phpinfo.php was not found on this server"

Then I tried


Action application/x-httpd-php /path/to/php

but that didn't do any good. phpinfo.php was still parsed by my host's PHP.

So the next shot was


Action application/x-httpd-php /path/to/php
AddType application/x-httpd-php php

which yielded the same error message as in the first case. So I figured application/x-httpd-php was not valid and tried only

AddType application/x-httpd-php foo

This way phpinfo.foo was parsed, as well as phpinfo.php. I cleared the .htaccess file one more time and typed

Action php-parser /path/to/php
AddType php-parser php

but that yielded the notorious error message "The requested URL...".

So.. I'm clueless. Totally. How do I use my PHP instead of my web host's. Does anyone have a clue? I'd really appreciate one..

Thanks in advance.

DrDoc

1:53 am on May 28, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to Webmaster World!

My web host's PHP doesn't provide curl

Curl is not a pure PHP function... so using your own PHP parser will not make a difference, especially not if your PHP version is simply copied and not configured.installed properly.

Swash

4:40 am on May 28, 2004 (gmt 0)

10+ Year Member



Be careful with curl. it can be very processor intensive

jsruok

6:03 am on May 28, 2004 (gmt 0)

10+ Year Member



Thank you for the warm welcoming, DrDoc.

And thanks for the warning, Swash. Luckily, curl is not used very often.

I configured PHP --with-curl so there should be no problem when it comes using it. I even tried the parser and curl with a .cgi file and everything works ok.

It's only that the app consists of dozens of .php files and in orded to use my PHP parser (the way I know) at the moment, I'd have to rename the files to .cgi and add the script handler on the first line. Development work of the app is not done on the web host's server but elsewhere. The list goes on.. Thus, there are multiple arguments which speak in favor of changing the default parser.

Thank you for the replies, though.

Did anyone get the idea or was I just too confusing? Is it possible to change the default parser with .htaccess?

corz

8:41 am on May 30, 2004 (gmt 0)

10+ Year Member



you dropped the "." from your php extension in the

AddType application/x-httpd-php php

line. is that significant? dunno, never tried to run an alternative parser on a web host.

And perhaps, in the Action line, quotes around the location of the binary would be worth inserting, who knows? it's all new to me. some things are platform indendant.

php has a rich variety of HTTP functions, is curl necessary?
and do web hosts realy allowing folks to run their own php binaries?

;o)
(or

jsruok

9:21 am on May 31, 2004 (gmt 0)

10+ Year Member



Thanks for the input, corz.

The dot does not matter. It works with or without.

Quotes are not needed. (I'm not sure if they'd work at all.)

Curl is necessary because it is being used by the nasty little program I'm trying to use within my app.

And some web hosts really do allow their clients to run their own binaries. My host even provides directions how to install php parser for myself.. (Although the directions do not work, but I like the idea. :-)