Tag: php
-
Generate a Random String of Same Pattern as Given String
Here is a PHP snippet showing how to generate a random string of same pattern as input string.
-
Install and Run Multiple PHP Versions in Ubuntu 22.04
I wanted to run both Drupal 7 and 9, as part of my work, in my machine now running on Ubuntu 22.04. Drupal 7 best run with PHP 5.6 while Drupal 9 requires either PHP 7.4 or 8.1 I could make it work after some research and try. Here is how I made it work.…
-
Quick Twig Template Rendering Without Much Set Up
Sometimes, I want to prepare more readable output from my PHP scripts. It is good to create a template and render with values from script out put. Here is a quick way to render a twig template. First lets assume the HTML twig template (test-report.html.twig) is: Then we have this script, test-script.php: Keeping above two…
-
Fixing gd Problem in PHP on Ubuntu 11.04
I was trying to enable gd for PHP in Ubuntu 11.04. As usual it should be typing in terminal: Unfortunately it does not worked and gd was not enabled. Typing the command php -a I was getting: PHP Startup: Unable to load dynamic library ‘/usr/lib/php5/20090626+lfs/gd.so’ – /usr/lib/php5/20090626+lfs/gd.so: undefined symbol: gdImageCreateFromJpeg in Unknown on line 0…
-
Resource Loader for PHP Web Applications
I wrote a resource loader class for PHP web applications. The class will help to manage loading of JavaScripts and CSSs we include within our web pages. Usually these JavaScripts and CSSs have dependencies with other scripts and or CSSs. For example, we have to load jQuery script file before any script that utilize jQuery…