• PHP Developers:The PHP Developers are also a part to make a website search engines friendly.
  • PHP and MySQL:The high-performance data warehouse applications in PHP and MySQL develop the organizational productivity with the newest updates in the current business trends.
  • PHP web application:PHP web applications are secure and tenable to use and also its better performance as well as easy to perform any tasks.
  • PHP opoen-Source:PHP is an open-source, easy-to-use and minimum complex language which doesn’t entail lengthy and difficult coding structure to develop a web based application. So developers can develop applications easily and in faster turnaround time.
  • Web developement

    Blog for latest news on web development technology, web application,web designing,web application company.

  • Software development

    Pegasus Info Corp is a leading company for web development, web application, software development. You can hire php developers, software developers, Search Engine Optimizer at affordable rate.

  • Best Open Source PHP Framework Development

    PHP Web Application Development provides an expert team of PHP programmers who deliver a wide range of PHP Web Applications for creating ...

Prepare for PHP 5.3

Posted by PHP Development On 3:28 AM No comments

PHP 5.3 is a full-size leap forward for PHP and brings of a lot of efficient features. Big leaps can also mean changes and potentially big splintering when it comes to backwards compatibility.

Here kevin from kevin.vanzonneveld.net sharing his  experience on PHP 5.3 with you.

How to install PHP 5.3 on Ubuntu Jaunty

After reading this article you may want to install PHP 5.3 and If you have not tried PHP 5.3 earlier or you want to give it a go right now, here is the basic tips on the PHP 5.3

·         start on a virtual Ubuntu Jaunty instance
·         Use the dotdeb.org repositories to install PHP 5.3 (Click on link to install PHP5.3)
·         Point Apache's (or whatever) document root to your workstation's shared code directory.

Et voila. An independent test platform that's able to reflect your code changes in real time.

Short Tags

When you do a fresh PHP 5.3 install on an Ubuntu Jaunty server, short tags, also known as:

<?
New releases can have support off by default, hence just showing code as plaintext. Including db passwords.
This is the stuff that can get you fired.

So if you have these short tags, lets get rid of them. But how, there are so many!

Update #1 - As noted by Rune Kaagaard and Philip Olson in the comments, support for short tags is still a subject of discussion. Whether it will be turned off by default or supported in PHP 6 also depends on the package maintainers of each distribution (looks like Ubuntu is going for the strict approach).

Regex to the rescue?

If you have a lot of short tags, the following regexes could help to convert them:

replace: '<?='
   with: '<?php echo '
 
replace: '<?(?!php|xml)'
   with: '<?php'

The order of these replace actions is important.

Now, be sure to **go over the changes manually **with a tool like regexxer though. Cause if you're not careful code generators, highlighters & XML tools will break. Consider the following real life example:

$CodeRow->replace('<?', '<?php', 'T_OPEN_TAG');'
By our replace action, this would now read:

$CodeRow->replace('<?php', '<?php', 'T_OPEN_TAG');'
Making that line completely useless and introducing a bug. So please, really go over the changes manually. Regexxer will make that job less painful already.

**Update #2: **As Bernhard mentions in the comments, there is a much better way of removing shorttags from your PHP code.

After the changes

Test your code thoroughly before you commit.

PHP Deprecated warnings

Some 'old' syntax still works but generates "Deprecated" warnings. These are telling you to change your code before it's too late: future versions of PHP will no longer support it. At all.
The following example is still used in quite some code, but as of PHP 5.3 will generate "Deprecated" warnings.

$log = & new Logger('file', '/var/log/app.log');
They want you to get rid of the '&'.

Obviously - if you are the author of such lines - you should change your code. Now is the time.
But let's say you also use a framework (CakePHP in my case), and you are not the author. You need to wait for others to fix it (don't worry, PHP 5.3 releases of Cake are in the works, just not stable yet). But if you still want to run PHP 5.3 right now with a deprecated framework codebase you can't change: you can turn off these warnings by changing the level of error reporting.

Here's an example that still let's you see other debug messages like Notices (which is great during development), but just turns off the Deprecated warnings (which are useless if they concern the framework's code):

error_reporting(E_ALL & ~ E_DEPRECATED);
.. basically saying: Show all warnings except deprecated.
So put this wherever you currently set the error_reporting level.
For CakePHP 1.2, I found I had to hack my core in /cake/libs/configure.php at line #291 to get rid of the deprecated warnings.

MySQL

In Ubuntu (thanks Philip Olson), PHP 5.3 uses a native MySQL driver (mysqlnd) and it enforces strong passwords. We still had some legacy 16bit MySQL passwords and so MySQL guru Erwin Bleeker upgraded them in order for mysql_connect to work. Good thing I suppose ;)

Extensions

I had some extensions like php5-xdebug, php5-xcache, php5-memcache that I previously installed with APT package management, but now gave version conflicts with my custom dotdeb.org packages.
Well, just uninstall them with apt (or rpm, or whatever) and reinstall them with pecl like this:
pecl install -f memcache
So that the extensions are rebuild for your current PHP version and the conflicts are resolved. Make sure your php.ini files point to the right .so files though.

0 comments:

Post a Comment