My search for a good PHP IDE never stops
My choice was Zend Studio until recently. But Zend Studio is not free and it’s free analogue – PDT – lacks some features like refactoring (PDT is also mainly developed by Zend, so, I think, Zend will always keep it low to prevent competition with Zend Studio). Also, it is monstrous (More than 300Mb installer) and it definitely lacks good Symfony support.
Recently I came across NetBeans, which is now free and developed by Sun. Sun seem to abandon all own IDE projects in favour of NetBeans, so this is a somehow strong foundation.
Oh… 25Mb installer only for PHP version
And… it is easy to use. Very. I would like to guide you through the creation of new symfony project in NetBeans.
Continue reading “Free opensource Symfony-friendly IDE: NetBeans 6.8″
Tags: ide, php, symfony
Hello.
I’d like to share my script, which I use on some production servers for quick database backup using mysql tools. People say, that I should use bash for that, but I prefer PHP
Script uses mysqldump for dumping databases and gzip for compressing backups. rm is run to ensure backups are not stored for too long.
Continue reading “[Linux, PHP] PHP script to backup all databases”
Tags: backup, mysql, mysqldump, php
Browing internet, I found the term of “quine” which is the program, that prints it’s exact source code. I was curious, if I am able to write such software. This is what I was able to compose:
<?php
$u='$';
$q="'";
$qq='"';
$s='<?php';
$e='?>';
$w='eval($p);';
$p='echo"$s\r\n{$u}u=$q$u$q;\r\n{$u}q=$qq$q$qq;\r\n{$u}qq=$q$qq$q;\r\n{$u}s=$q$s$q;\r\n{$u}e=$q$e$q;\r\n{$u}w=$q$w$q;\r\n{$u}p=$q$p$q;\r\n$w";';
eval($p);
It is a small and quite simple quine, however, I spent about several hours understanding how quines work and how to write them in PHP
Tags: php, quine
Recently I needed to quickly change charset on all tables and change each field’s chanset in each table in a specific database to latin1 and collation to latin1_swedish_ci. I googled a little and found this solution by shimon doodkin. I used it and it did work, but also it attempted to change charset at MySQL information_schema system database which is something I didn’t want to. It also proceessed all databases at MySQL server. Luckily, there was only two
It was a test server, that’s why I was uncareful.
Ok. I wrote a bit more elegant solution I would like to share with you today. It is pretty self-explanatory and is based on ALTER TABLE CONVERT TO charset MySQL statement.
Continue reading “[PHP, MySQL] Batch changing charset and collation on databases”
Tags: change charset, charset, charset conversion, CONVERT TO CHARACTER SET, mysql, php
My approach to writting mid-to-huge applications is to put each class to separate file and autoload class files on demand to eliminate the use of include/require statements completely. Autoloading in some cases can even speed up your project (for example, my scripts rarely throw exceptions. Exception classes are loaded by demand and only in case exception happend, so I remove
<?php
require_once('DatabaseException.php');
require_once('UserBOException.php);
overhead from my project. However, writting a good universal autoloader class is not trivial, however, simple. In this article I would like to suggest my own lightweigh multifunctional autoloader class.
Continue reading “[PHP] Writting Custom Class Autoloader Using SPL”
Tags: autoloading, FL_FLAutoloader, php, php autoload
Now PDO is most promising database access mechanism in PHP5. However, using PDO natively is not always convinient. In this article I will suggest my own lightweight wrapper for PDO calls, which simplyfies things for me. I am PHP5 fan, so we will use all object oriented technologies this language can give us in constructing our PDO wrapper.
Continue reading “[PHP] PDO: Wrapping and making sweet”
Tags: FL_DB_Connection, FL_DB_Exception, FL_DB_RecordsetObj, FR_DB, pdo, pdo wrapper, pgo_mysql, php, wrapper