Trying to get PEAR working for the first time
| From: | leegold | Date: | Sun, 12 Sep 2004 22:50:14 +0000 |
| Subject: | Trying to get PEAR working for the first time | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-14502@lists.php.net to get a copy of this message | ||
Trying to get PEAR working for the first time, using win32, I tried to copy an example right out of the PEAR web site, but when I try this php file in my browser it's just a blank page, also the "view page source" also is completely blank too.
The php has no syntax errors:
C:\Program Files\Apache Group\Apache2\htdocs>php -l peartest01.php
No syntax errors detected in peartest01.php
Also, from phpinfo: Configuration File (php.ini) Path:
C:\Program Files\Apache Group\Apache2\php.ini
And I noticed go-pear.bat put
;***** Added by go-pear
include_path=".;C:\php\pear"
;*****
in C:\WINNT so I also appended it in the ....Apache2\php.ini thinking that might be the problem, but it didn't help. I also put a copy of PEAR.ini in the apache2 dir too (?) but guess that's not the problem.
Below please find the code I tried, grateful for any help:
<?php
$data = array(
'0' => array("Bakken", "Stig", "", "stig@example.com"),
'1' => array("Merz", "Alexander", "alex.example.com", "alex@example.com"),
'2' => array("Daniel", "Adam", "", "")
);
require_once "C:\php\PEAR\HTML\Table.php";
$tableAttrs = array("width" => "600");
$table = new HTML_Table($tableAttrs);
$table -> setAutoGrow(true);
$table -> setAutoFill("n/a");
for($nr = 0; $nr < count($data); $nr++) {
$table -> setHeaderContents( $nr+1, 0, (string)$nr);
for($i = 0; $i < 4; $i++) {
if("" != $data[$nr][$i])
$table -> setCellContents( $nr+1, $i+1, $data[$nr][$i]);
}
}
$altRow = array("bgcolor"=>"red");
$table -> altRowAttributes(1, null, $altRow);
$table -> setHeaderContents(0, 0, "");
$table -> setHeaderContents(0, 1, "Surname");
$table -> setHeaderContents(0, 2, "Name");
$table -> setHeaderContents(0, 3, "Website");
$table -> setHeaderContents(0, 1, "EMail");
$hrAttrs = array("bgcolor" => "silver");
$table -> setRowAttributes(0, $hrAttrs, true);
$table -> setColAttributes(0, $hrAttrs);
echo $table->toHTML();
?>