Tags » PHP 2

Find and replace all <? short open tags using regex

In PHPStorm, you can do a regex find and replace. To upgrade a crappy old site using <?, just use the following regex:




systemctl automatically restart service


  1. Ensure systemd services restart on failure by Jon Archer
  2. php-fpm systemd unit with auto-restart by Juan Luis Boya García
  3. systemd Project Web Page

systemd is a system and service manager that runs as PID 1 and starts the rest of the system and services. 70 more words


Convert html to pdf using tcpdf in php

Download tcpdf and include require file.

include (‘tcpdf/tcpdf.php’);

Extend default class of tcpdf If you want edit or modify pdf

class MYPDF extends TCPDF {

363 more words

Simple Encryption & Decryption in php

function simple_mc_encrypt($text, $salt = "test@123"){
return trim(base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $salt, $text, MCRYPT_MODE_ECB, mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_RAND))));
// This function will be used to decrypt data.
function simple_mc_decrypt($text, $salt = "test@123"){
71 more words


Remove index.php In CodeIgniter

Secara default, index.php include di dalam URL.

Url tersebut tampak tidak enak dilihat, oleh sebab itu yuk kita ikuti langkah berikut agar index.php tidak tampil lagi. 68 more words


Execute SQL remotely on an IBM i via PHP's PDO ODBC from a Windows or Linux

You’ll first have to configure an ODBC connection “System DSN”/”System Data Source” via the “iSeries Access ODBC driver” or it might be call the IBM i Access driver which you can learn how to download and install here: 181 more words


Creating DOMElements from HTML strings

DOMDocuments are cool, and a really nice way of dealing with HTML in an OO fashion. However, sometimes, we have an HTML string element which we need to add to our Document. 115 more words