Install gammu on centos 7

To install Gammu on CentOS 7, follow these steps:

1. Update the system:

Bash
sudo yum update

2. Install dependencies:

Bash
sudo yum install gcc-c++ make libgsm-devel libncurses-devel

3. Download Gammu source code:

Bash
wget https://github.com/gammu/gammu/archive/refs/tags/v1.42.tar.gz

4. Extract the downloaded file:

Bash
tar -xzvf v1.42.tar.gz

5. Change to the Gammu directory:

Bash
cd gammu-1.42

6. Configure Gammu:

Bash
./configure

7. Compile Gammu:

Bash
make

8. Install Gammu:

Bash
sudo make install

9. Test Gammu installation:

Bash
gammu -v

This should output the Gammu version information if the installation was successful.

Additional Notes:

  • You can also install Gammu from the EPEL repository by enabling it and running sudo yum install gammu.
  • For more information and advanced usage, refer to the Gammu documentation: https://wammu.eu/docs/

Setup themes yii2 using advanced app

I'd be glad to assist you in creating a Yii2 application with the advanced template. Here's a comprehensive guide:

Prerequisites:

  • Yii2 installation: Ensure you have Yii2 installed on your system. You can download it from the official website (https://www.yiiframework.com/download).
  • Composer: Make sure Composer is installed. It's a dependency manager for PHP.

Steps:

  1. Create a new project directory:

    • Open your terminal or command prompt and navigate to the desired location.
    • Create a new directory for your Yii2 project:
      Bash
      mkdir my-yii2-project
      cd my-yii2-project
      
  2. Initialize the project using Composer:

    • Run the following Composer command to initialize a new Yii2 project using the advanced template:
      Bash
      composer create-project --prefer-dist yiisoft/yii2-app-advanced .
      
  3. Configure the project:

    • Open the common/config/main.php file and adjust the configuration settings as needed. This file contains global configuration options for your application.
    • Open the frontend/config/main.php and backend/config/main.php files to configure specific settings for the frontend and backend interfaces, respectively.
  4. Set up database connection:

    • In the common/config/main.php file, configure the database connection parameters under the components section:
      PHP
      'components' => [
          'db' => [
              'class' => 'yii\db\Connection',
              'dsn' => 'mysql:host=localhost;dbname=my_database',
              'username' => 'your_username',
              'password' => 'your_password',
              'charset' => 'utf8',
          ],
      ],
      
    • Replace the placeholders with your actual database connection details.
  5. Run migrations:

    • If you have created database migrations, run the following command to apply them:
      Bash
      ./yii migrate
      
  6. Start the application:

    • To start the frontend interface, run the following command in the project's root directory:
      Bash
      ./yii serve --config frontend/config/main.php
      
    • To start the backend interface, run:
      Bash
      ./yii serve --config backend/config/main.php
      

Additional notes:

  • The advanced template provides a structured and scalable architecture for Yii2 applications. It separates the frontend and backend interfaces, allowing for better organization and maintenance.
  • The common directory contains code that is shared between the frontend and backend.
  • The console directory is used for console applications and commands.
  • You can customize the project structure and configuration to fit your specific requirements.
  • Refer to the Yii2 documentation for more detailed information and examples.

By following these steps, you should have a successfully created Yii2 application with the advanced template.

Repair Centos Metadata Corruption

To repair disk error on Centos 7.

Use a Gparted disk that can be uploded in ....

1. Boot through gparted.

2. Go to the terminal

3. Check disk mapper by typing> fdisk -l

For fdisk results

4. typed> sudo xfs_repair -L / dev / mapper / centos-home
5. Restart Centos 7

Hope can help readers of this blog

Access phpMyAdmin from remote computer

Often in the software implementation process we need phpMyAdmin access via a computer other than the server.
When passing through the access we get a message:
Forbidden You do not have permission to access `phpmyadmin` on this server.
To complete this, edit the /etc/httpd/conf.d/phpMyAdmin.conf file by adding the Require all granted line



<Directory /usr/share/phpMyAdmin/>
   AddDefaultCharset UTF-8

  
<IfModule mod_authz_core.c>
     # Apache 2.4
    
<RequireAny>
       #Require ip 127.0.0.1
       #Require ip ::1
       Require all granted
    
</RequireAny>
  
</IfModule>
  
<IfModule !mod_authz_core.c>
     # Apache 2.2
     Order Deny,Allow
     Deny from All
     Allow from 127.0.0.1
     Allow from ::1
  
</IfModule>
</Directory>

 

Restart your httpd service : #service httpd restart


Thank you for reading this blog. Hope this helps you.

Make display inline radioButtonList on Yii Framework

By Default Yii display radioButtonList not inline like this :
$form->radioButtonList($model, 'gender', array('M' => 'Male', 'F' => 'Female'))

Change Code like this
$form->radioButtonList($model, 'gender', array('M' => 'Male', 'F' => 'Female'), array( 'labelOptions' => array('style' => 'display:inline'), 'separator' => ' '))
And Voila ... ! Thank's

Cascade delete parent child relation on Yii

Hello All, Sometimes we want to delete parent table on parent child relation on Yii, First we must set relation, Parent Model :
public function relations() { return array( 'Childs' => array(self::HAS_MANY, 'ChildModel', 'parent_id'), ); }
Child Model :
public function relations() { return array( 'Parent' => array(self::BELONGS_TO, 'ParentModel', 'parent_id'), ); }
On delete parent, at function below (parent model) :
public function beforeDelete(){ foreach($this->Childs as $c) $c->delete() return parent::beforeDelete(); }
That's all. Hope this post can help you.

Change Landing Page Yii Framework

In certain conditions, we want the first page of our application do directly into actual applications, but we want to explain in detail the application.
To do that we can redirect the application to a specific page by changing main.php at the directory config.


'defaultController' ='controller/action',

Example :
  
return array(
      ...
      'defaultController'=>home/index,
      ... 
 


);


Thx

Featured Post

Install gammu on centos 7

To install Gammu on CentOS 7, follow these steps: 1. Update the system: Bash sudo yum update 2. Install dependencies: Bash sudo yum install...