If you have used the query builder in yii 2.0.8 framework then to get the raw sql generated use the below statement.
$query->andFilterWhere([‘like’, ‘username’, $this->username])
->andFilterWhere([‘like’, ’email_id’, $this->email])
->andFilterWhere([‘registration_date’ => $this->register_date]);
// This is echo the raw query generated
var_dump($query->createCommand()->getRawSql());
$dataQuery->toSql(); // this will give you the actual query but this will not give the result with actual data values.
Now What ??
To get the Data binded with the sql statements , you should use the below function
$dataQuery->getBindings(); // This will return an array of data binded to the sql statement.
Now to get the final sql statement, you can use the below function and pass $dataQuery->toSql() and $dataQuery->getBindings() to the functions written below , which you can define it in your helper class or common functions class file.
$sqlwithData = getSqlWithBinding($dataQuery->toSql(),$dataQuery->getBindings());
or something like below if you have defined getSqlWithBinding function in common class.
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 named timezone for your location. For my location I would need , Kolkata, Asia.
Make note of the appropriate folder and file for your timezone. The active timezone used on your system is in the /etc/localtime file.
First, make a backup of the existing localtime file. It’s always safe to make backups of original config files.
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 cron job should run as per Indian time. So you have to add the following line before your cron job line.
CRON_TZ=”Asia/Kolkata” ## This is the important line
03 18 * * * wget http://www.abc.com/test.php >> /var/www/html/abc/logs/test-`date +\%Y\%m\%d`.log
`date +\%Y\%m\%d` => This will create the log as per date month and year wise. Date format enclosed by tick (`) sign
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\.
RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]