I am working on migrating legacy PHP application from PHP 5.2 to at least PHP 5.6. It is 50K+ lines application that heavily relies on enabled register_globals
directive and session_register()
/session_unregister()
functions. This functionality has been deprecated as of PHP 5.3.0 and removed as of PHP 5.4.0. I will demonstrate how to emulate register_globals
directive and session_register()
/session_unregister()
functions in PHP 5.6 or later.
PHP
How to format Laravel Blade templates in Visual Studio Code
Visual Studio Code is a wonderful editor and recently became my primary web development tool. I am developing using Laravel framework and there are many good extensions for Laravel and PHP in general. I configured PHP CS Fixer as my PHP formatter and Beautify as SASS/CSS, JavaScript and HTML formatter.
The only missing part was formatting Blade templates.
PHP: urlencode() vs. rawurlencode()
Difference between urlencode() and rawurlencode() PHP functions is not explained clearly in the official documentation. A few times I found myself looking it up online and decided to document it for future reference.
jQuery DataTables: Using WHERE, JOIN and GROUP BY with ssp.class.php
jQuery DataTables distribution comes with server_processing.php script and ssp.class.php class that add support for server-side processing and better performance for datasets with more that 10,000 records. However these files need to be tweaked if your query contains WHERE
, JOIN
or GROUP BY
clauses.
5 WordPress interview questions
See some WordPress interview questions below to sharpen your programming skills and practice.
PHP 5 / WordPress on Windows
Before going live with WordPress I have decided to try it out on my laptop. It was a time to upgrade my PHP installation as well. I downloaded and installed the most recent version of PHP 5 using ZIP archive and configured Apache accordingly. However the following message appeared when I tried to install WordPress:
Your PHP installation appears to be missing the MySQL extension which is required by WordPress.
It turned out PHP 5 was not configured to use MySQL by default. This is what I have changed in php.ini
compared to php.ini-recommended
.
extension_dir = "c:/php5/ext/" ... extension=php_mysql.dll extension=php_mysqli.dll ... session.save_path = "c:/windows/temp/"
Unfortunately it did not help. I was still getting the same error. It was a time to finally read the PHP installation manual.
And then the mystery was uncovered. In order for PHP to access MySQL database, file libmysql.dll
from PHP distribution “needs to be available to the Windows systems PATH”. I copied the file to C:\WINDOWS\system32
folder and it worked!