Jumat, 21 September 2018

Test Database Connectivity Using Php Script

1Many times, Influenza A virus subtype H5N1 organization administrator needs to seek out a connexion betwixt APP server as well as DB server. It tin mail away live required when around developer reporting upshot piece they connect to the Database server from their application. 

It is a really helpful PHP script that gives us really useful output as well as tin mail away assist inwards the troubleshooting. In this my blog, I'm going to portion a PHP script amongst around example.
Prerequisites- 

  • Database Server's HostName
  • A Database Name
  • DB user / Password
  • Another System installed PHP
Step 1- Create a PHP Script
To practise your PHP script inwards your lastly session practise a novel file using vi editors. 

$ vi db-test.php

Now, re-create the script below as well as glue inwards your file.

<?php $servername = "MySQL_Host"; $username = "MySQL_UserName"; $password = "MySQL_Password";  // Create connexion $conn = mysqli_connect($servername, $username, $password);  // Check connexion if (!$conn) {     die("Connection failed: " . mysqli_connect_error()); } echo "Connected successfully"; ?>  
$ php db-test.php  Connected successfully Establish to Database Server Name: '192.168.10.11'

Replace all the highlighted text amongst your's details.
Step 2 - Run PHP Script to seek out Database connectivity. 
There is 2 agency to run your PHP script. 
1- One yous tin mail away run from the lastly followed yesteryear this command. 

$ php db-test.php

If your connexion to DB server is successful, yous volition larn output similar this. 

2- You tin mail away house db-test.php file inwards your Apache document root folder as well as telephone telephone this script using the spider web browser. 
If your remote server has access to the DB server therefore yous Browser output volition live similar this.

You bring successfully tested Database connectivity using PHP script. 


Sumber https://linuxhowtoguide.blogspot.com/

Kamis, 20 September 2018

How To Enable Psremoting To Execute Powershell Script From Remote Machine.


PSRemoting (PowerShell Remote execution) - PowerShell Remoting allow yous run PowerShell ascendancy or Access amount PowerShell Session on remote Windows System. In other words, it's similar to SSH for accessing remote terminals from Remote computers.

PSRemoting disabled yesteryear default, you've to enable  PSRemoting earlier using it. 
Let's follow the procedure below to enable PSRemoting.


Prerequisites- 

  • Two Windows PC amongst Admin Rights.
  • One primary PC that nosotros volition access remotely.
  • Another to Run in addition to access PS of PC1.
Step 1- Enable PSRemoting (The PC volition access Remotely) - Let's follow the steps below to enable PSRemoting.
  • Open PowerShell every bit an Administrator account.

  • In the Powershell Window, Run the next ascendancy in addition to hitting Enter key
Enable-PSRemoting -Force















This ascendancy starts the WinRM service, sets it to starting fourth dimension automatically amongst your system, in addition to creates a firewall dominion that allows incoming connections. The -Force usage of the cmdlet tells PowerShell to perform these actions without prompting yous for each step.
If you're working on Domain network that is the procedure in addition to yous are cook to execute the Powershell ascendancy from the Remote PC.

Step 2- Follow the below procedure for Workgroup environment.
While you're working on homework or workgroup network hence yous conduct keep to trust your PC to connect remotely. 
Run the ascendancy below on the PC from where yous would to similar execute the commands.
Set-Item wsman:\localhost\client\trustedhosts *
The asterisk is a wildcard symbol for all PCs. If instead yous desire to limit computers that tin connect, yous tin supplant the asterisk amongst a comma-separated listing of IP addresses or figurer names for approved PCs.

After running that command, you’ll postulate to restart the WinRM service hence your novel settings conduct keep effect. Type the next cmdlet in addition to hence hitting Enter:

Restart-Service WinRM

All done, Now, you're cook to execute PowerShell script from a Remote computer.


Thank yous really much for reading my Blog, Please comment below whatever proposition or feedback to improve my Blog.


Sumber https://linuxhowtoguide.blogspot.com/

Minggu, 09 September 2018

Git - Apply Outset Repository Together With Clone On Local Reckoner Using Git-Bash Cli

GitHub -
Github is a nigh pop cloud-based opened upward source repository system, It allows the squad to act too submit their function at a key location. 


Developer too shop too acquire by their code, equally good equally rail too command changes to their code. mainly used for source code management inwards software development. It is a Command Line Interface(CLI) tool too tin move mastered easily. 


Prerequisites -

  • One Github delineate organisation human relationship - You tin ready your gratis delineate organisation human relationship (if don't have).
  • One Windows Machine amongst installed Git software.
Step 1- Download too install Git Software -
You tin download the latest version of Git from its official's site - https://git-scm.com/downloads
Once terminal the download, You tin start the installation past times double click on file - Git-2.18.0-64-bit.exe. It's real slow installation simply follow the steps.

Step 2- Create First Repository on GitHub:
Let's follow the steps below to produce your get-go Github repository -
  • Log on to your GitHub delineate organisation human relationship - https://github.com/login
  • Create your get-go Repo on the login page click on New Repository
  • On the side past times side shroud come inwards your repository name (myfirstrepo) > cheque on Public > click Initialize this repository amongst Readme  > Click on Create Repository.
Your Repository has created too initialized. Your side past times side shroud should move similar this.


Step 3- Setup SSH key 
In this case, we already initialized our repository spell nosotros ready it on GitHub delineate organisation human relationship too hence no necessitate to initialized here. 
Now, Open Git Bash on your local calculator too follow the steps below-
  • On the Git Bash command type command below too striking the come inwards push clit to generate SSH key.
$ ssh-keygen -t rsa -C "asingh@domain.com" 
You volition acquire output similar inwards below image.
  • Now opened upward /C/Users/amar/.ssh/id_rsa.pub file inwards your favourite editor too re-create the SSH key. You tin respect your file path inwards the electrical flow user's habitation directory within folder .ssh.

$ vi /c/Users/amar/.ssh/id_rsa.pub  ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDyph6mttPuEnUOWJFTuRmFNp7WS4xe1x4WPTzlanMf5PnTv1TQxWbchaITQQMGCqF+3/6/r8JTip5yuC0vaku+0CmFPCVfk3w8dmqew3n8b3/ki98ieei8OnPuALDC7+lrcknstl+MnF3WDsyi0ZEfvABaj6m3BUIGfwawG18+wcvgpaYYoPnKEXvYLY1D05ZlBW/9EQuHLHNimXGiwRqLFBI5qYSBC9pRXLA6X10gbaFORKuYJSQkpP4dKj7F8aD1tIASW55DtDtVrEWf2avyRh5Hca6Y0cO3+HvKnCSie3sUyZ+8A9gJmQ7sv629uIGNmpZrJGE9hfrv72zKgkH6f asingh@gmail.com 
  • Copy inwards a higher house ssh key too glue into your GitHub account.
  • Go into Git Hub delineate organisation human relationship settings -
  • Now, click on SSH too GPG key push clit on left side > NewSSH key as inwards below picture.

  • Now re-create your SSH key inwards the box. Copy SSH key from local organisation path -/C/Users/amar/.ssh/id_rsa.pub
Once you lot glue the SSH key click on Add SSH key button.

Step 4- Clone repository to your local system.
After successfully added SSH key, Your Git Bash is produce to clone your get-go Repository.
  • Log on to your GitHub delineate organisation human relationship too re-create Repository URL equally inwards the flick below - Change clone type to SSH earlier you lot re-create the URL


  • Once you lot re-create the repository URL type below command at your Git Bash shell.
$ git clone git@github.com:amars1986/myfirstrepo.git
  • Now become to your cloning path 
$ cd myfirstrepo/
  • Check the Repository condition using the git status command.
$ git condition  On branch master copy Your branch is upward to appointment amongst 'origin/master'.  zip to commit, working tree clean 
Your Git repository master copy branch is up-to-date. 

Your get-go cloning completed successfully, In my side past times side spider web log nosotros volition larn how to create, add, commit too force newly added file too folder to out Git repository


Sumber https://linuxhowtoguide.blogspot.com/