Category archive

PHP

Post related to PHP

37 articles

Laravel

how to get sql query from facade DB::table in laravel 5

Normally we fetch the data as below $dataresult = DB::table(‘sometable’) ->select(‘sometable.column1’, ‘sometable.column2’, ‘sometable.column3’, ‘sometable.column4’, ‘sometable.column5’) ->get(); Now if we want to get the actaul query from $dataresult using $dataresult->toSql(); // it will not work The solution for thi

Oct 7, 2017

Read article

linux

How to Change Timezone in CentOS

You check the time from the command line (run date), and find that the timezone is set to UTC or some other timezone. How do you get this changed? To change this you have to have root access to the server. There are a series of time zone files located at /usr/share/zoneinfo. Select the appropriate […]

Feb 2, 2016

Read article

linux

Timezone issue with cron

If your cron job timing does’t match with the server time zone for example. You have set the cron to run at 12:30 PM, but when you see the cron log the time show say 3:40 PM. So to run your cron job as per your time zone Say if you are in India, your […]

Feb 2, 2016

Read article

htaccess Setting

Force HTTPS url with .htaccess

RewriteCond %{HTTPS} off # First rewrite to HTTPS: # Don’t put www. here. If it is already there it will be included, if not # the subsequent rule will catch it. RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] # Now, rewrite any request to the wrong domain to use www. RewriteCond %{HTTP_HOST} !^www\. Rewrit

Jul 30, 2015

Read article

ffmpeg

create high quality video using ffmpeg

You can use the open source ffmpeg program to convert a media file from low quality to high quality format [shellprompt]# /fullpath/to/ffmpeg/ffmpeg -i source.mp4 -c:v libx264 -crf 19 destinationfile.flv OR [shellprompt]# /fullpath/to/ffmpeg/ffmpeg -i source.mp4 -c:v libx264 -ar 22050 -crf 28 destinationfile.flv Parame

Nov 23, 2013

Read article

ffmpeg

convert video from one format to another using ffmpeg

You can use the open source ffmpeg program to convert a media file from one format to another. Below is an exmple: [shellprompt]# /fullpath/to/ffmpeglibrary/ffmpeg -i InputFile.FLV OutputFile.mp3 There are various other options you can use to specify the attribute of the output file. Here are few of the examples code h

Nov 23, 2013

Read article

ffmpeg

create video thumbnail using ffmpeg

You can use the open source ffmpeg program to extract a frame to use as a thumbnail for a video. Below is an exmple: [shellprompt]# /fullpath/to/ffmpeglibrary/ffmpeg -i InputFile.FLV -vframes 1 -an -s 400×222 -ss 30 OutputFile.jpg -i = Inputfile name -vframes 1 = Output one frame -an = Disable audio -s 400×222 = Output

Nov 23, 2013

Read article

CMS

Set widget label from action file in symfony 1.4

In Action File ========================================================== $this->form = new youFormclassname(); To set individual Label $this->form->getWidget(‘widgetname’)->setLabel(‘widget Custom label’); To set multiple field label $this->form->getWidgetSchema()->setLabels(array( ‘field_name_1’ => ‘Field 1 Custom La

Aug 31, 2012

Read article

HTML

Replace any text from html text by tag name in php

function replace_tag_text($tagName,$subjectStr,$replaceStr) { $tagName = preg_quote($tagName); preg_match_all(‘{<‘.$tagName.'[^>]*>(.*?)</’.$tagName.’>}’,$subjectStr,$matches,PREG_PATTERN_ORDER); $result = str_replace($matches[1],$replaceStr,$subjectStr); return $result; } Usage : Say for Example $ActualStr : ‘<div><sp

Aug 2, 2012

Read article