Today, I work with Zend 6.3 community edition. This version include PHP Version 5.5.7.
I use php and mySQL to load data inside Adobe Air application by httpService with e4x result.
As I work with french language I had to manage characters with french accent.
Today, I use this function
function htmlPHP54($string) {
return htmlspecialchars($string, ENT_QUOTES,'ISO-8859-1');
}
Therefore each time I need to generate my xml file, I do something like that:
$return = "<rootsPHP>";
$return.="<name>".htmlPHP54($row_recordset['name'])."</name >";
$return. = "</rootsPHP>";
This method works well with Zend 6.3 and PHP 5.5.7
But today with Xammp (php 5.6.1), an error appears:
Error #1088: The markup in the document following the root element must be ... in the document follwing the root element must be well-formed”.
In fact when I try to open result file inside browser, the same error appear.
So I need help to solve that. What parameter must be changed inside php.ini or my.cnf?
Related
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.
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!
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
Am new to PHP and this is my first time using Zend Framework to convert a Word file to HTML file. I am using this code.
<?php
$mailMerge = new Zend_Service_LiveDocx_MailMerge();
$mailMerge->setUsername('myUsername')->setPassword('myPassword');
$mailMerge->setLocalTemplate('docs/file.docx');
$mailMerge->assign(null);
$mailMerge->createDocument();
$data = $mailMerge->retrieveDocument('html');
file_put_contents('docs/file.html',$data);
?>
Copied from http://www.phplivedocx.org/2009/08/13/convert-docx-doc-rtf-to-html-in-php/
I've even included the path of Zend in php.ini file.
include_path = ".;c:\php\includes;C:\ZendFramework-1.12.11\library"
But its still showing me the error.
Fatal error: Class 'Zend_Service_LiveDocx_MailMerge' not found in C:\wamp\www\word2html_zend\index.php on line 2
I've googled it and also searched in stackoverflow search.. But no solution worked for me.. What should I do to get the code to work?
EDIT::
Am using Windows 8 operating system and PHP version 5.5.12
it is not enough included the path for Zend. You need to register Zend autoloader before calling any class from Zend library,
like
// Initialize application loader
require_once 'Zend/Loader/Autoloader.php';
Zend_Loader_Autoloader::getInstance()->registerNamespace('Zend_');
I have a php web application that needs to access a PI-Datasource using an application-library written for windows on dll form to fetch the data. Due to the non-polimorphism of PHP we are using a wrapper written in C#-Dotnet in order to use the polimorphism library.
PHP->Wrapper->Lib->PI-System
The problem: PHP crashes, without leaving a log, on the creation of the com object (almost always on every second request). My thought was that probably something in the existing php code could be wrong that causes this fatal-error and after a lot of debugging and trying I simplified the code to this:
$connection = new Com('Something.SomethingClass');
with the variable $connection not being used NEVER! and still every 2nd time I get php-crash (documented in windows error log with an 1000-Error and an 1001-Information)
>Faulting application name: php-cgi.exe, version: 5.4.11.0, time stamp: 0x511a30ec
>Faulting module name: KERNELBASE.dll, version: 6.1.7601.17932, time stamp: 0x503275ba
>Exception code: 0xc0000005
>Fault offset: 0x0000d3cf
>Faulting process id: 0x14d0
>Faulting application start time: 0x01ce89dd0ae23748
>Faulting application path: C:\Program Files\Zend\ZendServer\bin\php-cgi.exe
>Faulting module path: C:\Windows\system32\KERNELBASE.dll
So i tried to generate even more com objects..
$connArray = array();
for($i = 0; $i < 50 ; $i++){
Core_System_Log::getInstance()->logWithoutMessageId('Before: ' . $i ,Core_System_Log::DEBUG);
$connArray[i] = new Com('Something.SomethingClass');
Core_System_Log::getInstance()->logWithoutMessageId('After: ' . $i, Core_System_Log::DEBUG);
}
All 50 were generated with no problem, and again every 2nd time i tried i got a php fatal error.
I tried to used all 50 of them, and they all read values from the PI-System with no problem.
I tried to unset the variables and call also the gc, call the destructor from C#, check the constructor from C# (which just makes an object of the library and had no exception, the object was normally created and still php crashed) but the problem did not disappear.
So, is there any idea? am i doing something wrong (how can it be wrong when every 2nd time it is properly reading the values)?
Environments Tested:
OS:Windows Server 2008 R2 64Bit / Windows 7 Prof SP1 32/64Bit
PHP: 5.3.9/ 5.3.14 / 5.3.21 / 5.4.11
WS: Apache and IIS (few different versions)
UPDATE: The problem was finally in the C# code. There was a call to GC which did not allow the COM object to be closed/deleted correctly having as a result C# to hang (again with no exception) and "triggering" the php fatal error.
Thanks for the responses.
If returns crashed without logging into file it look that in code contains sign #.
Example:
#some_function()
This will call function, but if has any errors it will not showing to you, just skipping. Due to some errors PHP can be stopped.
But, can you try upgrade PHP to 5.5 on Windows server?
If you know in which of lines of code throws an error and want to skip, just put isset()
If isset($somevar) or isset(function()) returns true that means are not errors, but if you don't want to stop a function on errors put isset() on a line of code where errors occurred.
I'm not sure how looks class and function inside PHP->Wrapper->Lib->PI-System code so I can tell fully corrected answer.
UPDATE: The problem was finally in the C# code. There was a call to GC which did not allow the COM object to be closed/deleted correctly having as a result C# to hang. The object was somewhere kept in Ram and the second time the wrapper was called it just hanged/exited (again with no exception) which "triggered" the php fatal error.