I've searched high and low for an answer to this. Hopefully someone
here might know. Can PHP be used under a CGI? I tried to put the
following code on one of my perl shopping cart pages but it doesn't
work:
echo "";
?>
It works fine on a .php page. I know that SSI will not work under
CGI, so maybe it's the same for PHP. Is there anyway to get this to
work?
Thanks,
Frank
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
RE: PHP and CGI
am 19.08.2009 02:44:55 von Daevid Vincent
> -----Original Message-----
> From: sono-io@fannullone.us [mailto:sono-io@fannullone.us]
> Sent: Tuesday, August 18, 2009 5:10 PM
> To: PHP General List
> Subject: [PHP] PHP and CGI
>
> I've searched high and low for an answer to this.
> Hopefully someone
> here might know. Can PHP be used under a CGI? I tried to put the
> following code on one of my perl shopping cart pages but it doesn't
> work:
>
>
> echo "";
> ?>
>
> It works fine on a .php page. I know that SSI will
> not work under
> CGI, so maybe it's the same for PHP. Is there anyway to get this to
> work?
Well, if you already have the page coded in Perl, why not just write those 5
lines in perl?!
It's a straight up for loop basically and some print statements. You're not
hitting a database or using anything remotely PHP-esque there.
I'm not so sure you can just mix and match parsers. I recall years ago some
talk of doing this, but I think it's just so rare and really impractical
that it's not worth setting up even if you can do it with some Apache magic.
Stick to one pre-processor language. Either all PHP or all Perl but not
both.
Daevid.
"Some people, when confronted with a problem, think 'I know, I'll use XML.'"
Now they have two problems.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: PHP and CGI
am 19.08.2009 04:02:52 von Shawn McKenzie
sono-io@fannullone.us wrote:
> I've searched high and low for an answer to this. Hopefully someone
> here might know. Can PHP be used under a CGI? I tried to put the
> following code on one of my perl shopping cart pages but it doesn't work:
>
>
> echo "";
> ?>
>
> It works fine on a .php page. I know that SSI will not work under
> CGI, so maybe it's the same for PHP. Is there anyway to get this to work?
>
> Thanks,
> Frank
PHP can run under CGI, however you're asking about mixing PHP with Perl.
CGI != Perl. CGI is the interface that your scripts have to the
programs that run them (i.e. Perl or PHP, etc...).
I've never done it, but to have both Perl and PHP parsed in one file,
you'd have to configure Apache (or your webserver) to parse the file
using PHP and then Perl. Not sure if it would do this sequencially though.
Another option may be to put the PHP in its own PHP file and then fetch
it into your Perl script.
--
Thanks!
-Shawn
http://www.spidean.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re: PHP and CGI
am 19.08.2009 04:13:55 von Shawn McKenzie
Andrew Mason wrote:
> If you already have it written in Perl, I would recommend writing the
> rest of functionality in Perl.
>
>
Please reply all. I agree, but I assumed that the problem was that he
knew PHP and he had downloaded a Perl cart and didn't know Perl.
-Shawn
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re: PHP and CGI
am 19.08.2009 04:47:42 von sono-io
On Aug 18, 2009, at 7:13 PM, Shawn McKenzie wrote:
> I assumed that the problem was that he
> knew PHP and he had downloaded a Perl cart and didn't know Perl.
That's exactly the case. I have been running my business on a Perl
cart for the last 5+ years, and I can't switch to a PHP cart just
yet. I was just hoping to add some functionality with PHP. Perl was
much harder for me to grasp than PHP, and from what I can tell, you
can't embed Perl in HTML as easy as you can with PHP, so I've switched
languages. I guess I was hoping for too much. =:(
Thanks,
Frank
P.S. Does anyone know of a good Perl mailing list?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re: PHP and CGI
am 19.08.2009 05:41:07 von kranthi
try adding
AddType application/x-httpd-php .pl --> or whatever extension your
perl script has
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: PHP and CGI
am 19.08.2009 16:12:00 von TedD
At 5:10 PM -0700 8/18/09, sono-io@fannullone.us wrote:
> I've searched high and low for an answer to this. Hopefully
>someone here might know. Can PHP be used under a CGI? I tried to
>put the following code on one of my perl shopping cart pages but it
>doesn't work:
>
>
>echo "";
>?>
>
> It works fine on a .php page. I know that SSI will not work
>under CGI, so maybe it's the same for PHP. Is there anyway to get
>this to work?
>
>Thanks,
>Frank
Frank:
I won't guarantee that this will work, but it's worth a try.
In your .htacess file add this:
# handler for phpsuexec. -- makes following prefixes considered for php
SetHandler application/x-httpd-php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re: PHP and CGI
am 19.08.2009 20:00:31 von Ben Dunlap
> =A0 =A0 =A0 =A0That's exactly the case. =A0I have been running my busines=
s on a Perl
> cart for the last 5+ years, and I can't switch to a PHP cart just yet. =
=A0I
> was just hoping to add some functionality with PHP. =A0Perl was much hard=
er
It would probably bomb your performance but you could always call a
separate PHP script from your Perl code:
#!/usr/bin/perl
# do some stuff in perl
my $php_output =3D `/usr/bin/php whatever.php`
# do something with $php_output
1;
If you're just looking to add some features quickly to your existing
Perl code: Have you searched CPAN for what you need?
Ben
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
RE: Re: PHP and CGI
am 19.08.2009 20:25:16 von Bob McConnell
From: sono-io@fannullone.us
> On Aug 18, 2009, at 7:13 PM, Shawn McKenzie wrote:
> P.S. Does anyone know of a good Perl mailing list?
beginners@perl.org
Or you can try www.perlmonks.org.
Bob McConnell
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
> In your .htacess file add this:
>
> # handler for phpsuexec. -- makes following prefixes considered for
> php
>
> SetHandler application/x-httpd-php
>
Thanks for the code. I placed it in the .htaccess file for the
output templates, but unfortunately it didn't work. It just prints
out part of the PHP code on the template: