Tuesday, February 23, 2021

Install and enable CURL extention for PHP 7.4 on Ubuntu 20.04

apt-get install php7.4-gd

apt-get install php7.4-curl


/etc/init.d/apache2 restart

How to Download and Install Virtualmin || Ubuntu 20.04

The easiest way to get the install script onto your server, is to login to your server and use wget or curl. For example:


# wget http://software.virtualmin.com/gpl/scripts/install.sh

For Virtualmin Professional, use the command suggested on your Software Licenses page.


Run the Install Script and Configure Virtualmin

Execute the downloaded install script using a command like the following:

sudo /bin/sh install.sh

WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! || SSH

Problem:

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
 WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! 
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the ECDSA key sent by the remote host is
SHA256:9cw8z+XkMzK09077WQVzFPZllB38LUzW+odbhEp3mm0.
Please contact your system administrator.
Add correct host key in /Users/imac/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /Users/imac/.ssh/known_hosts:14
ECDSA host key for [192.180.251.241] has changed and you have requested strict checking.
Host key verification failed.
olineit-iMac:~ imac$ ssh root@[IP or Hostname]


Solution:
ssh-keygen -R [hostname or IP]

Monday, February 22, 2021

PHP files prompts downloaded instead of executed in FCGId URL



In "/etc/apache2/mods-enabled/php.conf" (replace php with your filename, depending on the php version you're using - in my case it was php7.2.conf) comment out the following two lines:

SetHandler application/x-httpd-php

SetHandler application/x-httpd-php-source

Restart the apache server via the following command:

sudo service apache2 restart

Now set your webstite to FCGId (Virtualmin -> Server Configuration -> Website options -> PHP script execution mode ) and it should work properly.

Friday, November 6, 2020

Transfer and restore cPanel using command in WHM root account


This vidieo is cPanel transfer and restore technique. You can easily transter. and restore your cPanel without any website visiting or email service interruption.
A sample restore command:
/scripts/restorepkg/home/<<YourWHMUsername>>/backup-11.6.2020_23-26-09_<<YourcPanelUsername>>.tar.gz





Send html Form or Post data to Sendgrid contact list


How to Send html Form or Post data to Sendgrid contact list using PHP through API using JSON

################################## API ##############################
$curl = curl_init();

$list_ids="<<Your Contact List ID>>";

$first_name=$_POST['first_name'];
$last_name=$_POST['last_name'];
$email=$_POST['email'];

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.sendgrid.com/v3/marketing/contacts",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "PUT",
  CURLOPT_POSTFIELDS => "{\"list_ids\":[\"$list_ids\"],\"contacts\":[{\"address_line_1\":\"string (optional)\",\"address_line_2\":\"string (optional)\",\"city\":\"string (optional)\",\"country\":\"string (optional)\",\"email\":\"$email\",\"first_name\":\"$first_name\",\"last_name\":\"$last_name\",\"postal_code\":\"string (optional)\",\"state_province_region\":\"string (optional)\",\"custom_fields\":{}}]}",

  CURLOPT_HTTPHEADER => array(
    "authorization: Bearer SG.XXXXXXXXXXXXXX",
    "content-type: application/json"
  ),
));
$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  //echo $response;
    $_SESSION['message'] = "Thank You, we will get back to you in the next few days";
    
    if(isset($_POST['contactus'])){
        header('Location: contact.php');
    } else{
        eader('Location: sign-up.php');
    }
}

################################## API ##############################

Extract Domain from email in Excel or Google sheet

  =TEXTAFTER( A2 , "@") or, =MID(A1, FIND("@", A1) + 1, LEN(A1) - FIND("@", A1))