Category archive

PHP

Post related to PHP

37 articles

apache

401 Response when PHP-FPM Enabled on WordPress CMS

We recently migrated our website to another hosting service running FPM/FastCGI . We noticed under the website CMS -> tools -> Site Health Status , that all our REST API calls were failing authentication. It appeared to turn the request into an request from an Anonymous user even though we passed Basic Authentication h

Jan 2, 2025

Read article

PHP

How to show or hide yii2 gridview action button conditionally

In Yii2 Gridview normally to display the action button we have the following chunk of code $columns = [ [‘class’ => ‘yii\grid\SerialColumn’], ‘name’, ‘description:ntext’, ‘status’, [ ‘class’ => ‘yii\grid\ActionColumn’, ] ]; The output you see as below: Now you have a scenario, to show the edit button only when the “Zon

Jun 4, 2020

Read article

linux

export mysql database – mysql dump

When you have access to the command line and you have the export large database, you will not be able to export from phpmyadmin. Hence mysql provide you handy method to export the database from the command line. Below are various options, you can use while exporting the database. ——databases – This allows you to [&hell

Apr 14, 2020

Read article

linux

How to change the php version for the console

Many a times when you view the php version in the browser by displaying the phpinfo() information and the php version that is displayed when you see by typing the command “php -v” in the console or command prompt, You will notice that there is difference in the two. So how to set the php […]

Nov 18, 2019

Read article

CMS

Yii2 how to set custom value for checkbox in gridview widget

In Yii2, while you use gridview widget to display your table data, for performing any operation on the record by selecting the checkbox, gridview assign the value of the first column retrieved from your the result set. But you need to set some different value to the checkbox, so to do that you can use […]

Aug 4, 2019

Read article

CMS

How to wrap data column in Gridview widget in yii or yii2 framework

The column which you want to wrap should be added the property called “contentOptions” where you can apply the css property to suits your needs and requirements as below. [ ‘attribute’ => ‘column name’, ‘format’ => ‘html’, ‘noWrap’ => false, ‘mergeHeader’=>true, ‘contentOptions’ => [‘style’ => ‘width: 50%; overflow: sc

Nov 20, 2017

Read article

MVC

How to get raw sql query in yii or yii2 framework

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

Nov 15, 2017

Read article