[TriLUG] HOW do you get PHP TO PARSE in PERL script?
Joseph Tate
jtate at dragonstrider.com
Tue Aug 27 15:13:02 EDT 2002
Send me a copy of your httpd.conf file so that I can see if that's the
problem. I'm sure that it is. Also, what system are you running on.
Reginald Tchume wrote:
> What else do I do to get PHP to parse in a CGI/Perl environment?
>
> Please help!
> Reggie
>
>
>> From: Joseph Tate <jtate at dragonstrider.com>
>> Reply-To: trilug at trilug.org
>> To: trilug at trilug.org
>> Subject: Re: [TriLUG] HOW do you get PHP TO PARSE in PERL script?
>> Date: Sat, 24 Aug 2002 23:31:50 -0400
>>
>> Did you restart apache? Any time you make changes to the Apache
>> configuration files, you have to restart apache. Log in as root and
>> run 'service httpd restart'.
>>
>> Joseph
>>
>> Reginald Tchume wrote:
>>
>>> Joseph, I went to my controlpanel on the server and set the Apache
>>> handler to and the MIME types to what you suggested. I then re-did
>>> the script with <?php ?>. The results as you can see is still the
>>> same. Click here: http://careere.com/members/ama/email.php
>>>
>>> What do you suggest?
>>>
>>>
>>>> From: Joseph Tate <jtate at dragonstrider.com>
>>>> Reply-To: trilug at trilug.org
>>>> To: trilug at trilug.org
>>>> Subject: Re: [TriLUG] HOW do you get PHP TO PARSE in PERL script?
>>>> Date: Sat, 24 Aug 2002 18:33:00 -0400
>>>>
>>>> Ok, PHP is processed server side. What this means is that the code
>>>> is processed (i.e. parsed and executed) on the server. If you want
>>>> to run PHP serverside, you have to do two things:
>>>>
>>>> First is enclose PHP code in <?PHP ?> blocks, for example
>>>>
>>>> <?PHP
>>>> echo "Hello World!";
>>>> ?>
>>>>
>>>> The second thing you have to do is tell your web server to process
>>>> the files (usually something.php or something.phtml). In apache
>>>> it's done by adding lines to httpd.conf as follows:
>>>>
>>>> AddType application/x-httpd-php .php .php4 .php3 .phtml
>>>> AddType application/x-httpd-php-source .phps
>>>>
>>>> Once you have that done, rename email.html to email.php, and load
>>>> it up in your web browser. Then you should be good to go.
>>>>
>>>>
>>>>
>>>> Reginald Tchume wrote:
>>>>
>>>>> Hello, Joseph:
>>>>>
>>>>> Thank you for offering to help me with this. Frankly, I feel lost
>>>>> when trying to use this specialized knowledge you have about CGI
>>>>> and PHP.
>>>>>
>>>>> Here's what I set out to accomplish:
>>>>>
>>>>> I have embedded in an HTML code (webpage) this PHP script that
>>>>> will echo the respective email address of a member when a
>>>>> condition is met. You can view the code here in the VIEW SOURCE:
>>>>> http://careere.com/members/noah/email.html
>>>>>
>>>>> The variable on demand here is the: $username = ~username~;
>>>>>
>>>>> The PHP script runs fine when not handled thru the CGI script of
>>>>> my database software: As you can see here:
>>>>> http://careere.com/email.html
>>>>>
>>>>> What I need is to get the PHP to parse in this URL:
>>>>> http://careere.com/members/noah/email.html Is something I need to
>>>>> embed in the <head></head> of the webpage to make this parse?
>>>>>
>>>>> I am hosted on a Linux server with PHP4 and MySQL facilities.
>>>>>
>>>>> Thank you greatly for your help!
>>>>> Reggie
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>> From: Joseph Tate <jtate at dragonstrider.com>
>>>>>> Reply-To: trilug at trilug.org
>>>>>> To: trilug at trilug.org
>>>>>> Subject: Re: [TriLUG] HOW do you get PHP TO PARSE in PERL script?
>>>>>> Date: Sat, 24 Aug 2002 00:13:08 -0400
>>>>>>
>>>>>> You don't. You put it in the perl script.
>>>>>>
>>>>>> Let me see if I understand you correctly.
>>>>>>
>>>>>> You want to get the output of a php script to use in your perl
>>>>>> script right? Do you care about the output of the php script?
>>>>>> If not, then just execute it as
>>>>>>
>>>>>> #!/usr/bin/perl -w
>>>>>>
>>>>>> `php your_php_script.php`;
>>>>>>
>>>>>>
>>>>>> If you want the output to be read back in, you have to use
>>>>>> something like:
>>>>>>
>>>>>> open PHPSCRIPT, "/usr/bin/php your_php_script.php|";
>>>>>> # 'which php' to see where your command line php interpreter is
>>>>>>
>>>>>> Then you can parse the output from php like you would any open file.
>>>>>>
>>>>>> If you need to pass variables into the php script, I'm afraid
>>>>>> you're out of luck. It really shouldn't be that difficult to
>>>>>> port your PHP script to Perl though, unless it's thousands of
>>>>>> lines. Even a couple hundred lines should be doable in a couple
>>>>>> of hours.
>>>>>>
>>>>>> Let me know more about what system you're doing this on and what
>>>>>> you're trying to accomplish and I can help you better.
>>>>>>
>>>>>> Joseph
>>>>>>
>>>>>> Reginald Tchume wrote:
>>>>>>
>>>>>>> Thanks, Joseph. I am very new at this as I am not a programmer.
>>>>>>> So, how would that commandline version of the PHP read or look
>>>>>>> like? And where do I insert it in the PHP script?
>>>>>>>
>>>>>>>
>>>>>>>> From: Joseph Tate <jtate at dragonstrider.com>
>>>>>>>> Reply-To: trilug at trilug.org
>>>>>>>> To: trilug at trilug.org
>>>>>>>> Subject: Re: [TriLUG] HOW do you get PHP TO PARSE in PERL script?
>>>>>>>> Date: Fri, 23 Aug 2002 10:42:05 -0400
>>>>>>>>
>>>>>>>> Don't. Use PHP to parse the php script.
>>>>>>>>
>>>>>>>> `php script`
>>>>>>>>
>>>>>>>> Launch the commandline version of php from within your php
>>>>>>>> script and parse the output from that into perl.
>>>>>>>>
>>>>>>>> Joseph
>>>>>>>>
>>>>>>>> Reginald Tchume wrote:
>>>>>>>>
>>>>>>>>> Does anyone know how to get a PERL script to parse a PHP code?
>>>>>>>>>
>>>>>>>>> _________________________________________________________________
>>>>>>>>> MSN Photos is the easiest way to share and print your photos:
>>>>>>>>> http://photos.msn.com/support/worldwide.aspx
>>>>>>>>>
>>>>>>>>> _______________________________________________
>>>>>>>>> TriLUG mailing list
>>>>>>>>> http://www.trilug.org/mailman/listinfo/trilug
>>>>>>>>> TriLUG Organizational FAQ:
>>>>>>>>> http://www.trilug.org/~lovelace/faq/TriLUG-faq.html
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> _______________________________________________
>>>>>>>> TriLUG mailing list
>>>>>>>> http://www.trilug.org/mailman/listinfo/trilug
>>>>>>>> TriLUG Organizational FAQ:
>>>>>>>> http://www.trilug.org/~lovelace/faq/TriLUG-faq.html
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> _________________________________________________________________
>>>>>>> MSN Photos is the easiest way to share and print your photos:
>>>>>>> http://photos.msn.com/support/worldwide.aspx
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> TriLUG mailing list
>>>>>>> http://www.trilug.org/mailman/listinfo/trilug
>>>>>>> TriLUG Organizational FAQ:
>>>>>>> http://www.trilug.org/~lovelace/faq/TriLUG-faq.html
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>>> TriLUG mailing list
>>>>>> http://www.trilug.org/mailman/listinfo/trilug
>>>>>> TriLUG Organizational FAQ:
>>>>>> http://www.trilug.org/~lovelace/faq/TriLUG-faq.html
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> _________________________________________________________________
>>>>> Send and receive Hotmail on your mobile device: http://mobile.msn.com
>>>>>
>>>>> _______________________________________________
>>>>> TriLUG mailing list
>>>>> http://www.trilug.org/mailman/listinfo/trilug
>>>>> TriLUG Organizational FAQ:
>>>>> http://www.trilug.org/~lovelace/faq/TriLUG-faq.html
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> TriLUG mailing list
>>>> http://www.trilug.org/mailman/listinfo/trilug
>>>> TriLUG Organizational FAQ:
>>>> http://www.trilug.org/~lovelace/faq/TriLUG-faq.html
>>>
>>>
>>>
>>>
>>> Hello
>>>
>>> _________________________________________________________________
>>> Chat with friends online, try MSN Messenger: http://messenger.msn.com
>>>
>>> _______________________________________________
>>> TriLUG mailing list
>>> http://www.trilug.org/mailman/listinfo/trilug
>>> TriLUG Organizational FAQ:
>>> http://www.trilug.org/~lovelace/faq/TriLUG-faq.html
>>
>>
>>
>>
>> _______________________________________________
>> TriLUG mailing list
>> http://www.trilug.org/mailman/listinfo/trilug
>> TriLUG Organizational FAQ:
>> http://www.trilug.org/~lovelace/faq/TriLUG-faq.html
>
>
>
>
>
> _________________________________________________________________
> Chat with friends online, try MSN Messenger: http://messenger.msn.com
>
> _______________________________________________
> TriLUG mailing list
> http://www.trilug.org/mailman/listinfo/trilug
> TriLUG Organizational FAQ:
> http://www.trilug.org/~lovelace/faq/TriLUG-faq.html
More information about the TriLUG
mailing list