FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Using a heredoc in PHP as in Perl
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
Using a heredoc in PHP as in Perl [message #171885] Thu, 20 January 2011 09:00 Go to next message
P E Schoen is currently offline  P E Schoen
Messages: 86
Registered: January 2011
Karma: 0
Member
I am going to be using PHP to perform an HTML purification before the user's
input from a form is presented to a Perl script which saves the content and
presents it in HTML format. I am totally new to PHP and I have just a basic
working knowledge of Perl. In Perl, I use a heredoc which is done with a
statement such as:

print <<"END";
My Text...
END

I found several references such as http://en.wikipedia.org/wiki/Heredoc to a
similar means for PHP, but it did not work for me (parse error on line with
the <<<):

echo <<<EOF
My Text...
EOF;

I am actually using this to create HTML, and I found that it can be simply
written in the PHP document outside the <?php and ?> tags. But I would also
like to be able to use a heredoc to print to a file, and I don't know if
that is possible in PHP. If so, I'd appreciate any ideas on how to do it.
TIA.

Paul
Re: Using a heredoc in PHP as in Perl [message #171887 is a reply to message #171885] Thu, 20 January 2011 09:16 Go to previous messageGo to next message
Luuk is currently offline  Luuk
Messages: 329
Registered: September 2010
Karma: 0
Senior Member
On 20-01-11 10:00, P E Schoen wrote:
> I am going to be using PHP to perform an HTML purification before the
> user's input from a form is presented to a Perl script which saves the
> content and presents it in HTML format. I am totally new to PHP and I
> have just a basic working knowledge of Perl. In Perl, I use a heredoc
> which is done with a statement such as:
>
> print <<"END";
> My Text...
> END
>
> I found several references such as http://en.wikipedia.org/wiki/Heredoc
> to a similar means for PHP, but it did not work for me (parse error on
> line with the <<<):
>
> echo <<<EOF
> My Text...
> EOF;
>
> I am actually using this to create HTML, and I found that it can be
> simply written in the PHP document outside the <?php and ?> tags. But I
> would also like to be able to use a heredoc to print to a file, and I
> don't know if that is possible in PHP. If so, I'd appreciate any ideas
> on how to do it. TIA.
>
> Paul
>
>

The best syntax of a heredoc in PHP is found on the site with the docs
http://www.php.net

for 'heredoc' this is:
http://nl3.php.net/manual/en/language.types.string.php#language.types.strin g.syntax.heredoc

--
Luuk
Re: Using a heredoc in PHP as in Perl [message #171888 is a reply to message #171887] Thu, 20 January 2011 09:21 Go to previous messageGo to next message
Luuk is currently offline  Luuk
Messages: 329
Registered: September 2010
Karma: 0
Senior Member
On 20-01-11 10:16, Luuk wrote:
> for 'heredoc' this is:
> http://nl3.php.net/manual/en/language.types.string.php#language.types.strin g.syntax.heredoc

or (shorter)
http://www.php.net/heredoc

--
Luuk
Re: Using a heredoc in PHP as in Perl [message #171890 is a reply to message #171885] Thu, 20 January 2011 10:55 Go to previous messageGo to next message
alvaro.NOSPAMTHANX is currently offline  alvaro.NOSPAMTHANX
Messages: 277
Registered: September 2010
Karma: 0
Senior Member
El 20/01/2011 10:00, P E Schoen escribió/wrote:
> I am going to be using PHP to perform an HTML purification before the
> user's input from a form is presented to a Perl script which saves the
> content and presents it in HTML format.
> I am totally new to PHP and I have just a basic working knowledge of Perl.

Then, why don't you do it with Perl? I see little reason to add a second
server side technology under this conditions.


> In Perl, I use a heredoc
> which is done with a statement such as:
>
> print <<"END";
> My Text...
> END
>
> I found several references such as http://en.wikipedia.org/wiki/Heredoc
> to a similar means for PHP, but it did not work for me (parse error on
> line with the <<<):

As Luuk already said, the sensible place to find information about PHP
syntax is the PHP manual, not Wikipedia ;-)

>
> echo <<<EOF
> My Text...
> EOF;

I suppose the exact error is this:

Parse error: syntax error, unexpected $end, expecting T_VARIABLE or
T_END_HEREDOC or T_DOLLAR_OPEN_CURLY_BRACES or T_CURLY_OPEN

If it's complaining about missing T_END_HEREDOC it's because EOF was not
recognised as heredoc end delimiter. From the manual:

«The closing identifier must begin in the first column of the line.
Also, the identifier must follow the same naming rules as any other
label in PHP: it must contain only alphanumeric characters and
underscores, and must start with a non-digit character or underscore.»

.... and:

«It is very important to note that the line with the closing identifier
must contain no other characters, except possibly a semicolon (;). That
means especially that the identifier may not be indented,»

So my guess is that you indented it.


> I am actually using this to create HTML, and I found that it can be
> simply written in the PHP document outside the <?php and ?> tags. But I
> would also like to be able to use a heredoc to print to a file, and I
> don't know if that is possible in PHP. If so, I'd appreciate any ideas
> on how to do it. TIA.

Heredoc is only a syntax to create a string. Once you have a string, you
can handle it as any other string: PHP does not care how it was created.

http://es2.php.net/manual/en/book.filesystem.php


--
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://borrame.com
-- Mi web de humor satinado: http://www.demogracia.com
--
Re: Using a heredoc in PHP as in Perl [message #171893 is a reply to message #171885] Thu, 20 January 2011 12:05 Go to previous messageGo to next message
Captain Paralytic is currently offline  Captain Paralytic
Messages: 204
Registered: September 2010
Karma: 0
Senior Member
On Jan 20, 9:00 am, "P E Schoen" <p...@pstech-inc.com> wrote:
> I am going to be using PHP to perform an HTML purification before the user's
> input from a form is presented to a Perl script which saves the content and
> presents it in HTML format. I am totally new to PHP and I have just a basic
> working knowledge of Perl. In Perl, I use a heredoc which is done with a
> statement such as:
>
>     print <<"END";
>     My Text...
>     END
>
> I found several references such ashttp://en.wikipedia.org/wiki/Heredocto a
> similar means for PHP, but it did not work for me (parse error on line with
> the <<<):
>
>     echo <<<EOF
>     My Text...
>     EOF;
>
> I am actually using this to create HTML, and I found that it can be simply
> written in the PHP document outside the <?php and ?> tags. But I would also
> like to be able to use a heredoc to print to a file, and I don't know if
> that is possible in PHP. If so, I'd appreciate any ideas on how to do it.
> TIA.
>
> Paul

Either do it ALL in php or ALL in perl. Why mix the 2?
Re: Using a heredoc in PHP as in Perl [message #171907 is a reply to message #171893] Thu, 20 January 2011 19:38 Go to previous messageGo to next message
P E Schoen is currently offline  P E Schoen
Messages: 86
Registered: January 2011
Karma: 0
Member
"Captain Paralytic" wrote in message
news:c10032d0-d131-4484-8f22-c4178ddac2f1(at)g26g2000vbi(dot)googlegroups(dot)com...

> Either do it ALL in php or ALL in perl. Why mix the 2?

The HTMLpurifier is PHP:

<?php
require_once '../../library/HTMLPurifier.auto.php';
$config = HTMLPurifier_Config::createDefault();
$config->set('Core.Encoding', 'UTF-8'); // replace with your encoding
$config->set('HTML.Doctype', 'XHTML 1.0 Transitional'); // replace with
your doctype
$purifier = new HTMLPurifier($config);
$html = '<b>Simple and short'; // untrusted input HTML
$pure_html = $purifier->purify($html);
echo '<pre>' . htmlspecialchars($pure_html) . '</pre>';
?>

But my EventProcessor is in Perl. It might be worthwhile to rewrite it in
PHP, but there's another learning curve. I've seen pros and cons about each
language, and I chose Perl.

I need to add authentication to the server side, and my Perl script is in
the cgi-bin folder with permissions 711 where it can't be seen. I'm running
the PHP script in another folder and it has permissions 755. I suppose the
PHP document could be in the cgi-bin folder?

BTW, I found that my problem was related to a minor difference in syntax
between Perl and PHP for heredocs.

//But this does not work. Can't have semicolon after first EOF
// $str1 = <<<EOF;

www.pauleschoen.com/SCGBG/ErrorPHP.php

It was hard to find because I had it written correctly in one instance but
not the other, and the entire script failed.

Thanks.
Re: Using a heredoc in PHP as in Perl [message #171910 is a reply to message #171907] Thu, 20 January 2011 21:15 Go to previous messageGo to next message
P E Schoen is currently offline  P E Schoen
Messages: 86
Registered: January 2011
Karma: 0
Member
"P E Schoen" wrote in message news:gb0_o(dot)3626$LB4(dot)1808(at)newsfe06(dot)iad...

> I need to add authentication to the server side, and my Perl script is in
> the cgi-bin folder with permissions 711 where it can't be seen. I'm
> running the PHP script in another folder and it has permissions 755.
> I suppose the PHP document could be in the cgi-bin folder?

OK, I verified this, although I was concerned when the View|Source showed
something. However, it was only the HTML that was generated to stdin, so the
actual code is secure.

Now I'll see if I can use PHP to rewrite the entire EventProcessor, or just
call a short PHP script which will purify the HTML and then execute the perl
script.

Now, to help make the decision about Perl vs PHP, I found this:
http://www.thesitewizard.com/archive/phpvscgi.shtml

However I don't know if the example code is correct (I see two possible
errors):

<body>
<h1>My First PHP Script</h1>
<p>
Welcome, Internet user from IP address
<?echo $_SERVER['REMOTE_ADDR']?>.
Hope you like my first PHP page.
</body>

One downside to PHP may be the difficulty of installing it on my Windows
machine for local testing and debugging. It seems I must also install and
configure an Apache server, which is non-trivial. For Perl I am using
ActivePerl which installs with just a click of the mouse.

Another downside of PHP is the lack of "Taint" checking, which makes Perl
more secure in the case of subtle programming errors, or warnings really.

I will need to see if I can code the equivalent to the PHP for HTMLpurifier
in Perl:

<?php
require_once '../../library/HTMLPurifier.auto.php';
$config = HTMLPurifier_Config::createDefault();
$config->set('Core.Encoding', 'UTF-8'); // replace with your encoding
$config->set('HTML.Doctype', 'XHTML 1.0 Transitional'); // replace with
your doctype
$purifier = new HTMLPurifier($config);
$html = '<b>Simple and short'; // untrusted input HTML
$pure_html = $purifier->purify($html);
echo '<pre>' . htmlspecialchars($pure_html) . '</pre>';
?>

Thanks for the help and patience with a newbie.

Paul
Re: Using a heredoc in PHP as in Perl [message #171924 is a reply to message #171910] Fri, 21 January 2011 16:58 Go to previous messageGo to next message
Leonardo Azpurua is currently offline  Leonardo Azpurua
Messages: 46
Registered: December 2010
Karma: 0
Member
"P E Schoen" <paul(at)pstech-inc(dot)com> wrote:

> One downside to PHP may be the difficulty of installing it on my
> Windows machine for local testing and debugging. It seems I
> must also install and configure an Apache server, which is
> non-trivial.
> For Perl I am using ActivePerl which installs with just a click
> of the mouse.

Hi,

I did install PHP to run with WinXP IIS, and it works beautifully
(most of the time).

It didn't require any intervention beyond stating that I wanted to use
Fast-CGI, plus a littel change in php.ini in order to have errors sent
to the output (for some reason, it defaulted to off).

From time to time, PHP scripts stop responding, but I guess it is some
flaw in IIS itself. Stopping and restarting IIS restores things to
normal.

--
Re: Using a heredoc in PHP as in Perl [message #171934 is a reply to message #171910] Fri, 21 January 2011 22:05 Go to previous messageGo to next message
Twayne is currently offline  Twayne
Messages: 135
Registered: September 2010
Karma: 0
Senior Member
In news:gC1_o.21382$cj2(dot)16456(at)newsfe08(dot)iad,
P E Schoen <paul(at)pstech-inc(dot)com> typed:
> "P E Schoen" wrote in message
> news:gb0_o(dot)3626$LB4(dot)1808(at)newsfe06(dot)iad...
....

>
> One downside to PHP may be the difficulty of installing it
> on my Windows machine for local testing and debugging. It
> seems I must also install and configure an Apache server,
> which is non-trivial. For Perl I am using ActivePerl which
> installs with just a click of the mouse.

Actually, windows Apache servers are available in almost a turn-key
operation. It'll work for local testing right out of the box with XAMPP, in
fact. Then I just obtained the same rev of PHP the intended remote server
offered, and I was off and running in less than an hour counting download
time for the xampp package and PHP. IIRC it comes with PHP 5.2.3 or
thereabouts so if your server admin is any good the Apache install and the
included PHP might all work right out of the box. Oh, it'll also run as a
service, of course and comes with a PHP MYAdmin panel.
Be sure to read the security tips if you're going to put it where the
'net has access to it; as a test setup, some security is missing and of
course all the errors are turned on, not something you want in production.
IMO it's a great product. I've never had a single problem with it except
for stopping to update it now and then. It's free open source of course.
And, there are other similar packages out there but xampp is the one I
settled on so it's all I can really talk about.

>
> Another downside of PHP is the lack of "Taint" checking,
> which makes Perl more secure in the case of subtle
> programming errors, or warnings really.

Never came across "taint" checking; that's new to me, or I know it by a
different name. If all you mean is Checking user input for dubious or
erroneous values, PHP most definitely is easily capable of it. PHP above
version 5 can do some great things for sanitizing and preventing code
injection in form inputs, just about anything you can think of. JS seems to
be the favorite means of code injection in a gazillion different ways in
forms and PHP makes it pretty easy.
Warnings are something you NEVER want a visitor to see because it gives
away a lot of your methodology if someone is trying to hack you or find a
way in via a site form.

I don't mean to say that there is no other acceptable method; there
definitely is. But by minimizing 3rd party stuff and avoiding including
other applications midstream, I find I don't get lockups, crashes and other
nasty events that aren't expected.

Cheers,

Twayne`


>
> I will need to see if I can code the equivalent to the PHP
> for HTMLpurifier in Perl:
>
> <?php
> require_once '../../library/HTMLPurifier.auto.php';
> $config = HTMLPurifier_Config::createDefault();
> $config->set('Core.Encoding', 'UTF-8'); // replace with
> your encoding $config->set('HTML.Doctype', 'XHTML 1.0
> Transitional'); // replace with your doctype
> $purifier = new HTMLPurifier($config);
> $html = '<b>Simple and short'; // untrusted input HTML
> $pure_html = $purifier->purify($html);
> echo '<pre>' . htmlspecialchars($pure_html) . '</pre>';
>>
>
> Thanks for the help and patience with a newbie.
>
> Paul
Re: Using a heredoc in PHP as in Perl [message #171938 is a reply to message #171934] Sat, 22 January 2011 01:21 Go to previous messageGo to next message
P E Schoen is currently offline  P E Schoen
Messages: 86
Registered: January 2011
Karma: 0
Member
"Twayne" wrote in message news:ihcvuo$4ki$1(at)news(dot)eternal-september(dot)org...

> Actually, windows Apache servers are available in almost a turn-key
> operation. It'll work for local testing right out of the box with XAMPP,
> in fact. Then I just obtained the same rev of PHP the intended
> remote server offered, and I was off and running in less than an hour
> counting download time for the xampp package and PHP. IIRC it
> comes with PHP 5.2.3 or thereabouts so if your server admin is any
> good the Apache install and the included PHP might all work right out
> of the box. Oh, it'll also run as a service, of course and comes with a
> PHP MYAdmin panel.

> Be sure to read the security tips if you're going to put it where the
> 'net has access to it; as a test setup, some security is missing and of
> course all the errors are turned on, not something you want in production.

> IMO it's a great product. I've never had a single problem with it
> except for stopping to update it now and then. It's free open source
> of course. And, there are other similar packages out there but xampp
> is the one I settled on so it's all I can really talk about.

I downloaded it from http://www.apachefriends.org/en/xampp-windows.html and
now I have XAMPP installed. I copied my website files there, in the htdocs
folder, so I was able to use my EventSubmit.htm to enter data.

But it failed to run the EventProcessor.pl script in the cgi-bin folder. In
fact, I tried to open files located there using the IE8 browser
http://localhost and it gave errors of "Object Not Found", and with just the
URL for the cgi-bin I got a Forbidden error. Yet I was able to access the
files from FileZilla. And when I copied another directory I was able to use
its URL and access the contents. I tried setting permissions in FileZilla
and it complains that the chmod command is not implemented. I'll try the
forum and a search, but it's probably something simple.

>> Another downside of PHP is the lack of "Taint" checking,
>> which makes Perl more secure in the case of subtle
>> programming errors, or warnings really.

> Never came across "taint" checking; that's new to me, or I know
> it by a different name. If all you mean is Checking user input for
> dubious or erroneous values, PHP most definitely is easily capable
> of it. PHP above version 5 can do some great things for sanitizing
> and preventing code injection in form inputs, just about anything
> you can think of. JS seems to be the favorite means of code
> injection in a gazillion different ways in forms and PHP makes it
> pretty easy.

> Warnings are something you NEVER want a visitor to see because
> it gives away a lot of your methodology if someone is trying to hack
> you or find a way in via a site form.

I don't fully understand taint checking but here is a document that explains
it in great detail:
http://perldoc.perl.org/perlsec.html

I use it when checking a perl script from the command line where I also turn
on warnings. And there is also a command line option for compile only (-c)
which is useful for new code. It seems that PHP gives very detailed verbose
warnings and error messages, while for Perl, not so much.

Thanks for the ideas. It will be good when I finally fix this
implementation.

Paul
Re: Using a heredoc in PHP as in Perl [message #171943 is a reply to message #171938] Sat, 22 January 2011 02:55 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 1/21/2011 8:21 PM, P E Schoen wrote:
> "Twayne" wrote in message news:ihcvuo$4ki$1(at)news(dot)eternal-september(dot)org...
>
>> Actually, windows Apache servers are available in almost a turn-key
>> operation. It'll work for local testing right out of the box with
>> XAMPP, in fact. Then I just obtained the same rev of PHP the intended
>> remote server offered, and I was off and running in less than an hour
>> counting download time for the xampp package and PHP. IIRC it
>> comes with PHP 5.2.3 or thereabouts so if your server admin is any
>> good the Apache install and the included PHP might all work right out
>> of the box. Oh, it'll also run as a service, of course and comes with a
>> PHP MYAdmin panel.
>
>> Be sure to read the security tips if you're going to put it where the
>> 'net has access to it; as a test setup, some security is missing and
>> of course all the errors are turned on, not something you want in
>> production.
>
>> IMO it's a great product. I've never had a single problem with it
>> except for stopping to update it now and then. It's free open source
>> of course. And, there are other similar packages out there but xampp
>> is the one I settled on so it's all I can really talk about.
>
> I downloaded it from http://www.apachefriends.org/en/xampp-windows.html
> and now I have XAMPP installed. I copied my website files there, in the
> htdocs folder, so I was able to use my EventSubmit.htm to enter data.
>
> But it failed to run the EventProcessor.pl script in the cgi-bin folder.
> In fact, I tried to open files located there using the IE8 browser
> http://localhost and it gave errors of "Object Not Found", and with just
> the URL for the cgi-bin I got a Forbidden error. Yet I was able to
> access the files from FileZilla. And when I copied another directory I
> was able to use its URL and access the contents. I tried setting
> permissions in FileZilla and it complains that the chmod command is not
> implemented. I'll try the forum and a search, but it's probably
> something simple.
>
>>> Another downside of PHP is the lack of "Taint" checking,
>>> which makes Perl more secure in the case of subtle
>>> programming errors, or warnings really.
>
>> Never came across "taint" checking; that's new to me, or I know
>> it by a different name. If all you mean is Checking user input for
>> dubious or erroneous values, PHP most definitely is easily capable
>> of it. PHP above version 5 can do some great things for sanitizing
>> and preventing code injection in form inputs, just about anything
>> you can think of. JS seems to be the favorite means of code
>> injection in a gazillion different ways in forms and PHP makes it
>> pretty easy.
>
>> Warnings are something you NEVER want a visitor to see because
>> it gives away a lot of your methodology if someone is trying to hack
>> you or find a way in via a site form.
>
> I don't fully understand taint checking but here is a document that
> explains it in great detail:
> http://perldoc.perl.org/perlsec.html
>
> I use it when checking a perl script from the command line where I also
> turn on warnings. And there is also a command line option for compile
> only (-c) which is useful for new code. It seems that PHP gives very
> detailed verbose warnings and error messages, while for Perl, not so much.
>
> Thanks for the ideas. It will be good when I finally fix this
> implementation.
>
> Paul

Unfortunately, Paul, while XAMP is great for setting up Apache, MySQL
and PHP, it doesn't come configured for any other products, like Perl.
You'll need to do that part yourself.


--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: Using a heredoc in PHP as in Perl [message #171946 is a reply to message #171943] Sat, 22 January 2011 07:04 Go to previous messageGo to next message
P E Schoen is currently offline  P E Schoen
Messages: 86
Registered: January 2011
Karma: 0
Member
"Jerry Stuckle" wrote in message
news:ihdh01$tj8$1(at)news(dot)eternal-september(dot)org...

> On 1/21/2011 8:21 PM, P E Schoen wrote:
>
>> I downloaded it from http://www.apachefriends.org/en/xampp-windows.html
>> and now I have XAMPP installed. I copied my website files there, in the
>> htdocs folder, so I was able to use my EventSubmit.htm to enter data.
>
>> But it failed to run the EventProcessor.pl script in the cgi-bin folder.
>> In fact, I tried to open files located there using the IE8 browser
>> http://localhost and it gave errors of "Object Not Found", and with just
>> the URL for the cgi-bin I got a Forbidden error. Yet I was able to
>> access the files from FileZilla. And when I copied another directory I
>> was able to use its URL and access the contents. I tried setting
>> permissions in FileZilla and it complains that the chmod command is not
>> implemented. I'll try the forum and a search, but it's probably
>> something simple.

> Unfortunately, Paul, while XAMP is great for setting up Apache,
> MySQL and PHP, it doesn't come configured for any other products,
> like Perl. You'll need to do that part yourself.

I found the main problem was that you need to use the C:\xampp\cgi-bin
folder and not the one I created as C:\xampp\htdocs\cgi-bin. Even when I
renamed it I could not use it. Then I also had to change the "shebang" in my
Perl scripts to #!"\xampp\perl\bin\perl.exe", while with my ActiveState Perl
installation I could run with no change #!/usr/bin/perl -T. But then I got
errors (from the error.log):

Premature end of script headers: EventProcessor.pl
C:/xampp/cgi-bin/basic.php is not executable; ensure interpreted scripts
have "#!" first line

It also complained that the DateTime module was not installed and I tried to
install it but it still was broken. And as you can see above even the PHP
script would not run, except perhaps with a non-standard first line.

These scripts work fine on the live server. I don't know why an Apache
server on my machine would need so many adjustments to the scripts. I have
my cgi-bin folder at the root level, which should correspond to
C:\xampp\htdocs where I have my other folders for various websites. So I use
the relative location from my Perl script:

my $dbfile = "../SCGBG/SCGBG_Data.db";

But of course that won't work if the file is one level above the root. So it
seems that XAMPP may be better for Perl than PHP, but not really all that
good for either one at this point. I have a discussion going on the forum:

http://www.apachefriends.org/f/viewtopic.php?f=16&t=44187

I have since resolved some of the problems.

Thanks,

Paul
Re: Using a heredoc in PHP as in Perl [message #171949 is a reply to message #171946] Sat, 22 January 2011 14:57 Go to previous message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 1/22/2011 2:04 AM, P E Schoen wrote:
> "Jerry Stuckle" wrote in message
> news:ihdh01$tj8$1(at)news(dot)eternal-september(dot)org...
>
>> On 1/21/2011 8:21 PM, P E Schoen wrote:
>>
>>> I downloaded it from http://www.apachefriends.org/en/xampp-windows.html
>>> and now I have XAMPP installed. I copied my website files there, in the
>>> htdocs folder, so I was able to use my EventSubmit.htm to enter data.
>>
>>> But it failed to run the EventProcessor.pl script in the cgi-bin folder.
>>> In fact, I tried to open files located there using the IE8 browser
>>> http://localhost and it gave errors of "Object Not Found", and with just
>>> the URL for the cgi-bin I got a Forbidden error. Yet I was able to
>>> access the files from FileZilla. And when I copied another directory I
>>> was able to use its URL and access the contents. I tried setting
>>> permissions in FileZilla and it complains that the chmod command is not
>>> implemented. I'll try the forum and a search, but it's probably
>>> something simple.
>
>> Unfortunately, Paul, while XAMP is great for setting up Apache,
>> MySQL and PHP, it doesn't come configured for any other products,
>> like Perl. You'll need to do that part yourself.
>
> I found the main problem was that you need to use the C:\xampp\cgi-bin
> folder and not the one I created as C:\xampp\htdocs\cgi-bin. Even when I
> renamed it I could not use it. Then I also had to change the "shebang"
> in my Perl scripts to #!"\xampp\perl\bin\perl.exe", while with my
> ActiveState Perl installation I could run with no change #!/usr/bin/perl
> -T. But then I got errors (from the error.log):
>
> Premature end of script headers: EventProcessor.pl
> C:/xampp/cgi-bin/basic.php is not executable; ensure interpreted scripts
> have "#!" first line
>
> It also complained that the DateTime module was not installed and I
> tried to install it but it still was broken. And as you can see above
> even the PHP script would not run, except perhaps with a non-standard
> first line.
>
> These scripts work fine on the live server. I don't know why an Apache
> server on my machine would need so many adjustments to the scripts. I
> have my cgi-bin folder at the root level, which should correspond to
> C:\xampp\htdocs where I have my other folders for various websites. So I
> use the relative location from my Perl script:
>
> my $dbfile = "../SCGBG/SCGBG_Data.db";
>
> But of course that won't work if the file is one level above the root.
> So it seems that XAMPP may be better for Perl than PHP, but not really
> all that good for either one at this point. I have a discussion going on
> the forum:
>
> http://www.apachefriends.org/f/viewtopic.php?f=16&t=44187
>
> I have since resolved some of the problems.
>
> Thanks,
>
> Paul

It is the same Apache, PHP and MySQL that your hosting company is using
(except maybe the versions). The ONLY difference is that the three are
packaged all together and preconfigured to run. It makes for a much
simpler installation because you don't have to manually configure for a
majority of installations. It works for the vast majority of basic PHP
installations.

If you install the individual packages and configure them the same way
as in XAMP, you will get *EXACTLY* the same results. It just takes more
work.

If you need further help in configuring Apache, I suggest you ask in
alt.apache.configuration.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Placing an URL in email
Next Topic: HOW TO MAKE MONEY ONLINE? MOST RICH PEOPLE ACHIEVE FROM FOREX
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Wed Nov 27 07:20:31 GMT 2024

Total time taken to generate the page: 0.11124 seconds