PHP6?

Have you already play with PHP6?
Today I discovered the PHP6 CVS snapshots and I decided to take a look at it (still not tested).

I read some unhappy comment to the fact php want to put the Unicode settings into the php.ini, but if this change will make PHP faster  I would prefer in this way, expecially if unicode will be always set to on.
Is there a reason to put unicode support off in this world? (for example I haven’t still understood why wxPython continues to releases both ansi and unicode builds…)
Finally register globals‘ PHP3 BC to go!
Namespaces. Maybe they will add namespace.. I really hope so! This is indeed one of the most awaited features for me! (read about a discussion on namespaces)
Support for delegates.

My big hope is also to see a “real” strict type language, but this is only my though.
Backward Compatibility. Well this could cause a flame for many developers but if they really want to make a solid new product from scratch probably they dont have to take care about BC.

Read more about the PHP6 Novermber meeting and all the proposals.
Download the PHP6 snapshot

Debugging PHP with XDebug

In these days, working with PHP after a lot of time, I’ve installed this cool tool for debugging PHP (it supports both PHP 4 and 5).
XDebug is really useful for debugging PHP, which is usually not really easy to debug, and also easy to install.
It provides a lot of valuable debug informations, for example a full traceback for errors, profilig with memory and CPU usage, profiling functions , etc..
I really suggest to take a look at it!
Both Windows and Linux versions are available for download
http://www.xdebug.org

PHP5: a big failure ?

What’s happening ?
PHP 5 has been presented as a revolution, a lot of new features have been added and a lot of projects have been made. But only a small group of hosters seem interested in supporting PHP 5 on their web servers. It is not so useful to have a beautiful programming language to use if we can’t apply it to production environments.
But what about the causes ? Maybe they are related to the fact that Zend decided to support both PHP 4 and 5 separately, allowing hoster to choose which version to compile on their webservers, or maybe to the fact that PHP 5 is not fully compatible with the older versions, and there are some security-related bugs that increase our doubts.
I’m using a lot PHP 5 in production environments, without any problem. It is quite fast and reliable, and has got a lot of useful features that adapt perfectly to enterprise development. We MUST use PHP 5 to help it growing until it become the standard …
To conclude I’d like to inform the ones who don’t know it, that PHP team is working on the sixth version (yes … PHP 6 … and it is available for download at snaps.php.net) that will add to the language a lot of interesting features, such as native support to Unicode.
I hope there will be only one (working) version of PHP in the future …

Foundation PHP 5 for Flash

It was from days of Flash 5 which this book first time appeared. Long time has elapsed (expecially considering the informatic times).

Today I see that friends of Ed has published a new version of this book covering ActionScript 2.0, PHP 5 and MySQL 4.1.
Taking a look at the sample PDF chapter available it seems quite well done, clear and simple to read (ok, that is 2nd chapter and it talks of very basic things already…), but i noticed that it also threats of things/problems which often occured if you use php and flash everyday.. for example escape characters, magic_quotes_gpc etc..
I think i will going to get a copy of the book, it’s always useful take my mind under exercise…

Charset handling proposal in AMFPHP

Patrick Mineault makes a proposal for the charset handling in AMFPHP

[..] that should put an end to problems with Unicode and native character set handling between PHP and Flash, a problem that has palgued AMFPHP for a long time

To use charset handling in the new CVS version, you will need to call the setCharsetHandler function from your gateway.php file, like this:

$gateway->setCharsetHandler("iconv", "latin1", "latin1");

Detail for setCharsetHandler method: setCharsetHandler(string mode, string phpCharset, string sqlCharset) The mode can be: 1. none (don’t do anything) 2. iconv (uses the iconv libray for reencoding) 3. mbstring (uses the mbstring library for reencoding) 4. recode (uses the recode library for reencoding) 5. utf8_decode (uses the XML function utf8_decode and encode for reencoding – ISO-8859-1 only) I haven’t tested it already, but I’m sure this is a great step toward a solution of the charset problem!

http://www.amfphp.org/wiki/doku.php?id=charset_issue

Installing PHP5 on Apache server

Today i was trying to install the new PHP5 module on my local apache server.
It’s really simple at least, but when searching for instructions i discovered WAMP5, which includes in the installation:

  • Apache 1.3.31
  • PHP 5.0.0
  • MySQL 4.0.18
  • PhpMyAdmin 2.5.7
  • sqlitemanager

I’ve immediately installed it 😉
Once installed you’ll see a new tray icon with some options for your installed services.
I sugges it if you are thinking to install PHP5 on your local machine (i have also a separate apache/php4/mysql3 framework on my machine too, in this way i can always switch trought the two version of PHP/MySQL)

PHP 5.0.0 Released!

Finally, after months of release candidates…
Some of the key features of PHP 5 include:

* The Zend Engine II with a new object model and dozens of new features.
* XML support has been completely redone in PHP 5, all extensions are now focused around the excellent libxml2 library (http://www.xmlsoft.org/).
* A new SimpleXML extension for easily accessing and manipulating XML as PHP objects. It can also interface with the DOM extension and vice-versa.
* A brand new built-in SOAP extension for interoperability with Web Services.
* A new MySQL extension named MySQLi for developers using MySQL 4.1 and later. This new extension includes an object-oriented interface in addition to a traditional interface; as well as support for many of MySQL’s new features, such as prepared statements.
* SQLite has been bundled with PHP. For more information on SQLite, please visit their website.
* Streams have been greatly improved, including the ability to access low-level socket operations on streams.
* And lots more…

http://www.php.net

PEAR::SWF updating… read and modify swf with PHP

I’ve just begun to modify the old PHP class flashHeader. Now using the PEAR::File class for a better file I/O processes.
Basically now, other than returning all the main information from an swf file, such as the bg color, framerate, player version, compression, protection used, movie size.., it allows to modify some of those parameters.
For example it can change the framerate, background, protection… I’m also working in order to allows the class modify some other swf tags in runtime..
Working example

Here the source file

<?php
// include the PEAR package
require “File/File_SWF.php”;
$flash = new SWF(“source.swf”);
if(
$flash->is_valid()){
$stat = $flash->stat(); // this give all the info
// and also..
$fps = $flash->getFrameRate();
$size = $flash->getMovieSize();
$bg = $flash->getBackgroundColor();
$prot = $flash->getProtected();
$compr = $flash->getCompression();
$version = $flash->getVersion();

// they can be changed…
$flash->setFrameRate(60);
$flash->setProtected(1);
$flash->setBackgroundColor(51,51,204);
$flash->setCompression(1);

// and write a new file…
$flash->write(“./new_one.swf”,1);
}
?>