PHPJasperXML for PHP 7 - php

As we already know, PHP 7 has been working in diferents plataforms now, I have been using PHPJasperXML to create different kinds of report with ireport for php, but mi reports stopped working after migrating my system to PHP 7.
Someone knows how to resolve this problem, or someone has been able to modify the phpjasperxml library for working in php 7?

I have updated some of the scripts to be compatible with php7
change
public function PHPJasperXML($lang="en",$pdflib="TCPDF") {
$this->lang=$lang;
$this->setErrorReport(0);
$this->pdflib=$pdflib;
if($this->fontdir=="")
$this->fontdir=dirname(__FILE__)."/tcpdf/fonts";
}
on file PHP JasperXML.inc.php to
function __construct($lang="en",$pdflib="TCPDF") {
$this->lang=$lang;
$this->pdflib=$pdflib;
}
then change old mysql connections of
$this->myconn = #mysql_connect($db_host,$db_user,$db_pass);
to
$this->myconn = #mysqli_connect($db_host,$db_user,$db_pass);

See
https://github.com/PHPJasper/phpjasper
has support to PHP 7
About
PHPJasper is the best solution to compile and process JasperReports (.jrxml & .jasper files) just using PHP, in short: to generate reports using PHP.
Notes:
PHPJasper Can be used regardless of your PHP Framework
For PHP versions less than 7.0 see: v1.16
Here are several examples of how to use PHPJasper

Related

Problem with configuration of LiveQuery in Parseplatform

Hello i have installed Parse server and parse sdk for php on my Linux Centos Server.
Parse Dashboard: 1.3.3,
Server version: 4.3.0
I'm managing those db's using php code. This parser was installed by someone else. The thing is I'm not sure how to install LiveQuery for my server. I don't know if my version of server is good for this kind of operations. I found some solutions how to enable this feature, but there was something like "index.js" - in my file system it's app.js. Screen of file system
In app.js i added lines:
liveQuery: {
classNames: ["Test"] //List of classes to support for query subscritions
}
I've created class in my db named "Test", then i found solution i need to add
this line
liveQueryUrl: keyLiveQueryUrl, // Required if using LiveQuery
I don't really know how to get this key.
How can i check if LiveQuery works? It will be used by flutter code, but i'd like to check it first in PHP.
My problem has been solved in my other extended topic here.

Quickest way to get Expression Engine v 2.5.5 working with PHP7

A client’s host has recently updated their server to run PHP 7, which has broken their EE 2.5.5. site (“Call to undefined function mysql_connect()”).
I tried upgrading EE to version 2.11.9 but get errors:
Frontend: can’t find safecracker_lib
Control Panel: PATH_MOD not defined in mod_structure.php, fixing this leads down a rabbit hole starting with an error related to not being able to instantiate the pagination class somewhere.
I just need to get the site running until I build a new site, what is the quickest way I can get the site running with PHP 7?
In your config folder there is a file named database.php
change the line:
$db['expressionengine']['dbdriver'] = 'mysql';
to
$db['expressionengine']['dbdriver'] = 'mysqli';
mysql_connect() has been deprecated since PHP 5 and removed in PHP 7 so you cannot use this function or any of the old mysql functions.
You need to upgrade your codebase, or downgrade your PHP version (highly discouraged).
In regards to your missing pagination class, you may not have implemented core classes that were required when upgrading.
Try running on your command line:
php system/ee/eecms upgrade
You can also read the documentation on how to upgrade the codebase for Expression Engine here.

The setHex method of PHP MapScript doesn't work

I'm using PHP MapScript 6.4 to interact with my Mapfile.
I try to use the setHex() colorObj method like that:
$oStyle->color->setHex($color);
Where $color is an hexadecimal value as we can see in my logs
But regarding the MapScript https://mapserver.org/mapscript/php/phpmapscript.html#colorObj I can use setHex() method.
It works perfectly fine with $oStyle->color->setRGB(255,255,255); for example, so why not setHex()?
I'm using MapScript 6.4, I have looked at the 6.0.1 release documentation and the setHex() method exists.
thanks for using MapServer ! Here are some important points:
setHex() is not available in MapServer 6.x for PHP MapScript: you can find the documentation for your exact version by:
going to https://mapserver.org
goto "Documentation" https://mapserver.org/documentation.html
at the top click on "Documentation for earlier versions of MapServer can be found on the Download page"
there you can see the various versions you can download for the documentation, such as 6.4 https://mapserver.org/pdf/MapServer-64.pdf
search for "setHex" and you will only find it only inside the SWIG MapScript section
setHex() and toHex() for PHP MapScript were added to the MapServer 7.0.0 release (ticket: https://github.com/MapServer/MapServer/pull/5078)
I've now added the text "new in version 7.0.0" to the colorObj for those methods at https://mapserver.org/mapscript/php/phpmapscript.html#colorobj
Please also note:
there was a major vulnerability found in PHP MapScript recently (6.4.4 and 7.4.4 were released for this reason)
PHP MapScript is unsupported/unmaintained, and therefore SWIG MapScript is recommended moving forward (which has full PHP7 support)
Thanks for using MapServer. Happy (fast) mapserving!
-Jeff McKenna

PHP class 'Ds\Map' not found

In PHP (version 7.1), I am attempting to use a MAP as opposed to a two dimensional array to handle implicit data type conversion across different data type groups. However, I am receiving the following run-time error:
Class 'Ds\Map' not found
The error occurs on this line of code:
protected $hive_data_type_group_map = new \Ds\Map();
I have checked online, but there is little documentation on Ds\Map, even on PHP's website (click here). Does anyone know how to fix this?
Data Structures is not a built-in PHP extension.
It needs to be installed before use. The installation instructions are available on php.net.
For windows
Download compiled-dll file "php_ds.dll" from https://pecl.php.net/package/ds. Place it in your dir wamp\bin\php\[your_php_version_folder]\ext and include it in your ".ini" file.
It worked for me.
the easiest way on ubuntu:
pecl install ds
Reference: https://www.php.net/manual/en/ds-deque.allocate.php

Phppgadmin, No objects found

I am trying to get my localhost db listed in phpPgAdmin, but it says No object found phppgadmin GUI
I have already configured conf/config.inc
$conf['servers'][0]['desc'] = 'PostgreSQL'
$conf['servers'][0]['host'] = 'localhost';
$conf['servers'][0]['port'] = 5432;
$conf['owned_only'] = false;
Any help please, I have tried with Postgresql versions 9.2,9.5,10.3(not supported by phppgadmin?)
EXPLANATION OF THE PROBLEM
I see the problem! This error message is a bug in the phpPgAdmin code, which apparently has older code that was written before PHP 7.x was released.
The error in phpPgAdmin will appear if you've recently downloaded a technology stack with all of the latest versions of PHP, PostGreSQL and phpPgAdmin. For example... today's (Feb. 2019) latest versions are:
PHP 7.3.1
PostGreSQL version 11
phpPgAdmin 5.6 (Nov. 12, 2018) <= This doesn't work with PHP 7.x, but we want it to work with it and we can make it work with it!
PHP.net explains the problem in their Constructors and Destructors page:
Warning Old style constructors are DEPRECATED in PHP 7.0, and will be
removed in a future version. You should always use __construct() in
new code.
Their example is in this section on that page:
Example #2 Constructors in namespaced classes
<?php
namespace Foo;
class Bar {
public function Bar() { <- This is an older style of creating a constructor.
For PHP 7.x, it should be changed to "__construct" instead of "Bar".
// treated as constructor in PHP 5.3.0-5.3.2
// treated as regular method as of PHP 5.3.3
}
}
?>
Now that we know what the problem is, here is how to solve it.
SOLUTION
Look in your /phpPgAdmin/ folder on your web server. You should find the following files in the /classes/ sub-folder:
ArrayRecordSet.php <- Replace function ArrayRecordSet with function __construct
class.select.php <- Replace function XHtmlSimpleElement with function __construct
Gui.php <- Replace function GUI with function __construct
Misc.php <- Replace function Misc() with function __construct
Plugin.php <- Already has function __construct
PluginManager.php <- Already has function __construct
Edit those files & change any of the constructor names - which appear as duplicate class names - to __construct.
When you save those files & reload phpPgAdmin in your browser, then you will see that the "No objects found" message will have disappeared. It will then display a server name.
Voilà! The latest version of phpPgAdmin 5.6 works with the latest version of PHP 7.3.1 & the latest version of PostGreSQL 11!
If you want to check the XML contents of that left tree, simply append this to your website as this is the rest of the URL, which it's using: /phppgadmin/servers.php?action=tree. That will help make debugging the phpPgAdmin code easier to do.
You can also remove the action=tree querystring parameter. Or search for it inside of the phpMyAdmin code.
BUG REPORT
I'll see about submitting a phpPgAdmin bug report to with the link to this page. Hopefully, someone will fix this error in the phpPgAdmin code base.
Have fun using the latest version of phpPgAdmin, PHP & PostGreSQL!

Categories