php-windows Digest 2 May 2009 14:24:53 -0000 Issue 3616
Topics (messages 29310 through 29313):
Re: Win32 PECL pre-built binaries.
29310 by: Philip Olson
Re: PHP and Crystal Reports
29311 by: Richard Quadling
29312 by: Richard Quadling
Re: How to access MySQL through PHP in windows 2K.
29313 by: Keisial
Administrivia:
To subscribe to the digest, e-mail:
php-windows-digest-subscr...@lists.php.net
To unsubscribe from the digest, e-mail:
php-windows-digest-unsubscr...@lists.php.net
To post to the list, e-mail:
php-wind...@lists.php.net
----------------------------------------------------------------------
--- Begin Message ---
I see one such bug, are there others?
- http://bugs.php.net/bug.php?id=46021
Here are some:
Duplicate bugs are given the bogus status and typically link to the
parent bug. Looks like that happened a few times here, but the bug
evolved and was prematurely closed. It's open now. Windows geeks,
please look into bug #46021 and close it. If it's not closed by Friday
(when the manual builds) I'll address [hack] it the best I can.
I can see why some people were against us having a wiki because these
'where is what when how?' problems become more frequent. But as for
the Windows build stuff, I consider the manual to be documentation and
the wiki entry a supplemental to it.
And as for the Windows PECL binaries, this large task could use more
bodies so people feel free to help. Pierre, please post an update/todo
regarding this task so we all know about it and how to help.
Regards,
Philip
--- End Message ---
--- Begin Message ---
2009/4/30 John Messam <johnm...@hotmail.com>:
>
> I am trying to write a php program that opens a number of reports written in
> Crystal 11. From research on the internet, I found that CR would have to be
> called using COM. So I did that. From the command line it triggers a dialog
> box saying that the version of Crystal the reports was written in was later
> than the one that is being used to open it via the php program. The other
> problem is that when it is run from the browser the program hangs on the
> openReport command
>
>
>
> Can anyone assist me on resolving the hanging issue or the entire thing for
> that matter.
>
>
>
> Thanks!
>
>
>
> John
>
> _________________________________________________________________
> Show them the way! Add maps and directions to your party invites.
> http://www.microsoft.com/windows/windowslive/products/events.aspx
I use Crystal all day and via PHP also.
Here is the code I use (edited). It might not be perfect, but it works
perfectly.
<?php
// Create an Crystal Object Factory.
$o_CrObjectFactory = new COM('CrystalReports11.ObjectFactory.1');
// Create the Crystal Reports Runtime Application.
$o_CrApplication =
$o_CrObjectFactory->CreateObject("CrystalRunTime.Application.11");
// Register the typelibrary.
com_load_typelib('CrystalDesignRunTime.Application');
// Load the report.
$o_CrReport = $o_CrApplication->OpenReport('C:\Report.rpt', 1); // 1
== crOpenReportByTempCopy.
// Logon to the database.
$o_CrReport->Database->LogOnServer
(
'odbc',
'Accounts',
registryDatabaseLocations::Database('Accounts'),
registryDatabaseLocations::Username('Accounts'),
registryDatabaseLocations::Password('Accounts')
);
// Don't tell anyone what is going on when running live.
$o_CrReport->DisplayProgressDialog = False;
$s_ExportedReport = 'C:\Report.pdf';
// Run the report and save the PDF to disk.
$o_CrReport->ExportOptions->DiskFileName = $s_ExportedReport;
$o_CrReport->ExportOptions->PDFExportAllPages = True;
$o_CrReport->ExportOptions->DestinationType = 1; // Export to File
$o_CrReport->ExportOptions->FormatType = 31; // 31 = PDF, 36 = XLS, 14 = DOC
// Assign the parameters to the report.
$m_Stuff = new Variant();
$o_CrPeriodsParam =
$o_CrReport->ParameterFields->GetItemByName('PeriodIDs', $m_Stuff);
$o_CrPeriodsParam->ClearCurrentValueAndRange();
foreach($_SESSION['tabRG_PeriodIDs'] as $i_Period)
{
$o_CrPeriodsParam->AddCurrentValue(intval($i_Period));
}
$o_CrReport->ReadRecords();
$o_CrReport->Export(False);
?>
--
-----
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
"Standing on the shoulders of some very clever giants!"
--- End Message ---
--- Begin Message ---
2009/4/30 John Messam <johnm...@hotmail.com>:
> Thank you for responding. I get the following
> <
> Fatal error: Uncaught exception 'com_exception' with message '<b>Source:</b>
> Unknown<br/><b>Description:</b> Unknown' in C:\wamp\www\ledermode\cr4.php:15
> Stack trace: #0 C:\wamp\www\ledermode\cr4.php(15):
> com->CreateObject('CrystalRunTime....') #1 {main} thrown in
> C:\wamp\www\ledermode\cr4.php on line 15
>
> Your comments please.
>
>> From: rquadl...@googlemail.com
>> Date: Thu, 30 Apr 2009 09:03:16 +0100
>> To: johnm...@hotmail.com
>> CC: php-wind...@lists.php.net
>> Subject: Re: [PHP-WIN] PHP and Crystal Reports
>>
>> 2009/4/30 John Messam <johnm...@hotmail.com>:
>> >
>> > I am trying to write a php program that opens a number of reports
>> > written in Crystal 11. From research on the internet, I found that CR would
>> > have to be called using COM. So I did that. From the command line it
>> > triggers a dialog box saying that the version of Crystal the reports was
>> > written in was later than the one that is being used to open it via the php
>> > program. The other problem is that when it is run from the browser the
>> > program hangs on the openReport command
>> >
>> >
>> >
>> > Can anyone assist me on resolving the hanging issue or the entire thing
>> > for that matter.
>> >
>> >
>> >
>> > Thanks!
>> >
>> >
>> >
>> > John
>> >
>> > _________________________________________________________________
>> > Show them the way! Add maps and directions to your party invites.
>> > http://www.microsoft.com/windows/windowslive/products/events.aspx
>>
>> I use Crystal all day and via PHP also.
>>
>> Here is the code I use (edited). It might not be perfect, but it works
>> perfectly.
>>
>> <?php
>> // Create an Crystal Object Factory.
>> $o_CrObjectFactory = new COM('CrystalReports11.ObjectFactory.1');
>>
>> // Create the Crystal Reports Runtime Application.
>> $o_CrApplication =
>> $o_CrObjectFactory->CreateObject("CrystalRunTime.Application.11");
>>
>> // Register the typelibrary.
>> com_load_typelib('CrystalDesignRunTime.Application');
>>
>> // Load the report.
>> $o_CrReport = $o_CrApplication->OpenReport('C:\Report.rpt', 1); // 1
>> == crOpenReportByTempCopy.
>>
>> // Logon to the database.
>> $o_CrReport->Database->LogOnServer
>> (
>> 'odbc',
>> 'Accounts',
>> registryDatabaseLocations::Database('Accounts'),
>> registryDatabaseLocations::Username('Accounts'),
>> registryDatabaseLocations::Password('Accounts')
>> );
>>
>> // Don't tell anyone what is going on when running live.
>> $o_CrReport->DisplayProgressDialog = False;
>>
>> $s_ExportedReport = 'C:\Report.pdf';
>>
>> // Run the report and save the PDF to disk.
>> $o_CrReport->ExportOptions->DiskFileName = $s_ExportedReport;
>> $o_CrReport->ExportOptions->PDFExportAllPages = True;
>> $o_CrReport->ExportOptions->DestinationType = 1; // Export to File
>> $o_CrReport->ExportOptions->FormatType = 31; // 31 = PDF, 36 = XLS, 14 =
>> DOC
>>
>> // Assign the parameters to the report.
>> $m_Stuff = new Variant();
>>
>> $o_CrPeriodsParam =
>> $o_CrReport->ParameterFields->GetItemByName('PeriodIDs', $m_Stuff);
>> $o_CrPeriodsParam->ClearCurrentValueAndRange();
>>
>> foreach($_SESSION['tabRG_PeriodIDs'] as $i_Period)
>> {
>> $o_CrPeriodsParam->AddCurrentValue(intval($i_Period));
>> }
>>
>> $o_CrReport->ReadRecords();
>> $o_CrReport->Export(False);
>> ?>
>>
>>
>>
>> --
>> -----
>> Richard Quadling
>> Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
>> "Standing on the shoulders of some very clever giants!"
>>
>> --
>> PHP Windows Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>
> ________________________________
> Invite your mail contacts to join your friends list with Windows Live
> Spaces. It's easy! Try it!
Did you edit the code to fit your requirements? I don't know what your
report uses for a database, so you will need to amend the login
details.
Judging by the fact that it was line 15 that went wrong, it looks like
the Crystal Runtime is installed correctly.
Essentially when you run Crystal you need to logon to the data source.
My code uses a registry class to extract the credentials (and I use
ODBC for all of the reports, though to different types of data -
MSSQL, Excel, Sage Retrieve 4GL, etc.)
--
-----
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
"Standing on the shoulders of some very clever giants!"
--- End Message ---
--- Begin Message ---
Jacob Kruger wrote:
> FWIW, while I'm using windows xp pro, I just use the WAMP package to run
> php, mysql and apache on my machine:
> http://www.wampserver.com/en/
>
> All I've done extra is make it run using port 81 so I can also still
> run IIS
> for asp.net stuff.
>
> Stay well
> Jacob Kruger
> Blind Biker
> Skype: BlindZA
> '...fate had broken his body, but not his spirit...'
"Installation on Windows Systems: (...) Once PHP has been installed,
some configuration is required to enable /mysqli/ and specify the client
library you want it to use.
As mentioned earlier, the /mysqli/ extension is not enabled by default,
so the php_mysqli.dll DLL must be enabled inside of php.ini. In order to
do this you need to find the php.ini file (typically located in c:\php),
and make sure you remove the comment (semi-colon) from the start of the
line /extension=php_mysqli.dll/, in the section marked [PHP_MYSQLI]." --
http://php.net/manual/en/mysqli.installation.php
--- End Message ---