Install Php Windows Git Bash

Git

Introduction

Download the files. Download the latest PHP 5 ZIP package from www.php.net/downloads.php.

Developers are usually more used to Unix based system to set up all environments, but there are times we have to use Windows. If this is the case, setting up Git on windows is a must. This article briefly reviews all the steps from Git installation to SSH set up. Hope you find this article helpful.

Overview

Download Composer Latest: v2.0.9. To quickly install Composer in the current directory, run the following script in your terminal. To automate the installation, use the guide on installing Composer programmatically. Here is how to enable or install BASH on Windows 10. How to Enable or Install BASH on Windows 10. Go to Settings Apps and Features and click on the link Programs and Features on the top right. It will open the “Uninstall Program Section”. Look for an option which says ” Turn Windows Features on or off.” on the left. How to Launch Git in Windows Git has two modes of use – a bash scripting shell (or command line) and a graphical user interface (GUI). Launch Git Bash Shell To launch Git Bash open the Windows Start menu, type git bash and press Enter (or click the application icon).

  1. How to install Git on Windows
  2. How to set up SSH keys for Git
  3. Things need to be careful with

1. Install Git on Windows

First download Git for Windows on the official website: git-scm.com/downloads

Install

Run the downloaded file and do the setup.

On the “Select Components” page, we can leave it as is, or you can change upon your own preference.

Php

On the “Adjusting your PATH environment” page, we want to select the first option: “Use Git from Git Bash only“, unless you really want to use Windows Command Prompt. Git Bash feels like a unix-like terminal and it is capable to do most of the work we need.

On the “Configuration the line ending conversions” page, you can select based on your need. Again, I would recommend the third option: “Checkout as-is, commit as-is“, as this is the safest option for our code.

Next page, we can just select the first option: “Use MinTTY“.

On the “Configuring extra options” and “Configuring experimental options” page, leave as it or select on your need.

Now we can just hit the Install button and finish the installation.

Once it is installed, we can open the Git Bash and give it a try. Type git command.

2. Set up SSH Keys

Now that we got Git running, it is time to set up SSH keys for Git, so that we don’t need to input password every time. It is more convenient but also safer.

The concept is we create a public/private key pair; put the public key to the remote server, and keep the private key on your local machine. The server can authenticate the client if the client has the corresponding private key.

First we need to generate key pair. Type this command on Git Bash:

Burt bacharach affairs. ssh-keygen -t rsa

For now, we can just press Enter to use default key name and empty passphrase.

‘id_rsa’ is the private key, and ‘id_rsa.pub’ is the public key.

Next we want to put the public key to the remote server. Different servers have different requirements of how to publish your public key. For GitHub, we can just follow user setting -> SSH Keys page and copy the public key there.

For the private key, the location and key name doesn’t really matter; we can config the Git to use the correct path of private key, see here. However, if the key path is

~/.ssh/id_rsa

Git

then it should work out-of-the-box without any configuration.

To verify SSH is working for our Git, we can try the following command on Git Bash:

ssh -T [email protected]

If everything works well, then the prompt would say “You’ve successfully authenticated“.

Last thing, to use SSH login, the remote urls of repositories need to be SSH type, instead of HTTPS type. See here to change it.

3. Things need to be careful with

  • We do want to keep the private key in a safe place, and set the permission to be only readable to yourself: -r-------- (mode 400).
  • If you need SSH access for multiple git users, I found this post is very helpful. Basically you need to add the username as part of the host name of the repository, and then add the same hostname and corresponding private key file in the config file ~/.ssh/config.
  • Let me also mention Cygwin (ignore this if you don’t have Cygwin installed). It happened on my laptop that Git and Cygwin were not compatible with each other and I couldn’t use Git as normal.
Install php windows git bash tutorial

Install Php Windows Git Bash Linux

End

Git Bash Download Windows 10

Thanks for your reading. Please leave comments if you have any questions.

PHP 5.2.9.2 Install on XP Pro IIS 5.1 - phpinfo( ) results incorrect
Testing Date: 05.15.09
Background:
For several days now I, as a newbie, have been unsure if I had installed PHP correctly, or not. No matter what I did phpinfo( ) reported 'Configuratin File Path' as: “C:WINDOWS”. I was left to wonder what was wrong.
To help resolve the phpinfo() “issue”, I conducted a series of tests using two scripts:
The first is “test-php-ini-loaded.php”; it is stored in c:inetpubwwwroot, and has the following code:
<?php
$inipath
= php_ini_loaded_file();
if (
$inipath) {
echo
'Loaded php.ini: ' . $inipath;
} else {
echo
'A php.ini file is not loaded';
}
?>

The second script is simply calls phpinfo( ). It is named test.php, is stored in “c:inetpubwwroot”, and has the following code:
<?php phpinfo( ); ?>

My Dev Environment:
1. Windows XP Pro SP3
2. IIS 5.1 / MMC 3.0
3. PHP 5.2.9.2 – phpMyAdmin not yet installed
4. (plus MySQL 5.1, etc.)
5. Install location is on my local E: drive
The Tests:
Test 1:
a. PHPRC environment variable and IniFilePath Registry left in place and active
b. Verified no other copies of php.ini exist on the system other than in my E:PHP folder
c. Renamed php.ini to hold-php.ini
d. Stopped and started IIS (“net stop iisadmin” and “net start w3svc”)
e. Ran “test-php-ini-loaded.php” to check whether my php.ini is loaded. It is not.
f. Ran 'test.php'. “Loaded Configuration File” was empty, while “Configuration File (php.ini) Path” showed: C:WINDOWS.
Test 2:
a. Moved php.ini from E:PHP to C:WINDOWS
b. Stopped and started IIS
c. Ran 'test-php-ini-loaded.php' to check if my php.ini is loaded. It is not, which surprised me.
d. Ran 'test.php'. My php.ini is apparently not loaded, or found, by phpinfo( ), even though “Configuration File (php.ini) Path” reports it as being in C:WINDOWS.
e. Note: Per PHP’s “The configuration file” note, PHP's search order includes: “Windows directory (C:windows or C:winnt) (for Windows), ..”; but it apparently doesn’t or php.ini would have been found and displayed at “Loaded Configuration File”.
Test 3:
a. Left the solo copy of my php.ini in C:WINDOWS
b. Disabled PHPRC environment variable by renaming it to “Ex-PHPRC and saving the settings (note: for this test I left the Registry entry for PHP IniFilePath intact)
c. Stopped and started IIS
d. Ran 'test-php-ini-loaded.php' to check whether my php.ini is loaded. Predictably it is not found.
e. Ran the 'test.php'. Again, my php.ini file is reported as not found in C:WINDOWS though “Configuration File (php.ini) Path” reports it as being there.
Test 4:
a. To be thorough and eliminate all possible sources of “mis-direction” I deleted the PHP IniFilePath Registry entry (after backing up the Registry). The PHPRC environment variable was left disabled.
b. Stopped and started IIS
c. Ran 'test-php-ini-loaded.php' to check whether my php.ini is loaded. Predictably it is not.
d. Ran 'test.php'. Again, no change. My php.ini file is not found “Configuration File (php.ini) Path” reports it as being there.
Conclusions:
The first conclusion I came to is that, in the default download version of phpinfo( ), “Configuration File (php.ini) Path” is hard-wired to report C:WINDOWS whether php.ini is there or not. Further, that C:WINDOWS is not a default search location (at least not on XP).
However, given an otherwise “proper” setup, phpinfo() reporting C:WINDOWS as the value for “Configuration File (php.ini) Path” is merely misleading and is not actually harmful or indicative of a failed installation.
Thanks go to Peter Guy of www.peterguy.com who suggested the testing, and to Daniel Brown of www.php.net for some initial guidance.
P.S. This note is not meant to take anything away from PHP. It is a fine tool. The sole purpose of the testing was to confirm that my installation of PHP was correct.