Regular expression examples

Remove style in html tag

$text = preg_replace(“/style=\”[^\”>]+\”/i”, ”, $text);


<span style=”font-family: Georgia, serif;” style=”font-family: Georgia, ‘Times New Roman’, Times, serif; font-size: 16px; line-height: 26px;”>some text</span>


<span >some text</span>

Increase timeout on apache server on ubuntu 18

Sometimes we need to have more time for executing heavy script on apache server. In this case, it shows time out error like this.

504 Gateway Time-out

To increase limit, we need to check 2 things. Apache and PHP configuration.

Increase in PHP

Open the php.ini file and modify below.

vi /etc/php/7.0/apache2/php.ini<br>

Below is just example, change the value according to your needs.

max_execution_time = 120
max_input_time = 120
memory_limit = 256M

Increase in Apache

Open Conf file and add below.

cd /etc/apache2/sites-available/
vi yourfile.conf

Set timeout

TimeOut 600