Skip to content

Instantly share code, notes, and snippets.

@rplaurindo
Last active April 6, 2023 18:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rplaurindo/34dde00d90548cbd78b68cb673bb87c6 to your computer and use it in GitHub Desktop.
Save rplaurindo/34dde00d90548cbd78b68cb673bb87c6 to your computer and use it in GitHub Desktop.
Installing PHP interpreter

Downloading

Download the interpreter source code here.

After download the interpreter source code (preferable), set in the environment variables of the Windows.

Setting up the PHP interpreter in the environment variables

At Path key set the php interpreter path.

Learn more here.

Installing PHP interpreter via APT

Adding PPA

$ sudo add-apt-repository ppa:ondrej/php

$ sudo apt update

Installing

$ sudo apt install -y php<version>

Installing PHP interpreter and Apache module (HTTP Server) via XAMPP Project

Dowloading the XAMPP Project

Download distributions here.

Follow the steps and at end run localhost in the URL bar to test if Apache module it works.

Install your projects

Your projects should be placed on ...<x>:\xampp-folder-instalation\htdocs.

.ini file

In the php.ini file you should to uncomment extension_dir = "exe" on the Operating System Windows.

Using Socket

To use socket you should to uncomment (remove semicolon) the line extension=sockets. If you need to encrypt the stream, uncomment extension=openssl;

Done. Now you can try the php command in the DOS terminal.

$ php -v

On Windows

Enabling the Curl Extension

Open the php.ini file and uncomment extension=curl removing the ; character.

Downloading

The latest stable version of .phar file is here.

See more.

Installation

  • Put the composer.phar file in a folder composer-<version>;

  • On Windows, open the CMD as Administrator and create a symbolik link of this folder, like that:

    $ mklink /d"<UNITY_LETTER>:...\composer <UNITY_LETTER>:...\composer-<version>

  • Create a composer.bat file in the same path of composer.phar file. Open the terminal in the path of .phar file, and run:

    $ echo @php "%~dp0composer.phar" %* > composer.bat

Note: between the last " and % there must be a space.

Alias for Bash on Windows

That enables executing without .bat.

Create the .bash_profile file at <UNITY_LETTER>:\Users\<username> running:

$ echo alias composer=composer.bat >> .bash_profile

$ source .bash_profile

Using

Installing all dependencies

Inside your PHP Project run on terminal:

$ composer install

So the dependencies defined in composer.json will be installed.

Updating All Dependencies

$ composer update

Installing a Dependency Individually

$ composer require <vendor>/<package> [<version statement>]

Updating the Composer

$ composer self-update

Clear Cache

$ composer clear-cache

Working with a Proxy server

Set HTTP_PROXY as http://<user>:<password>@<domin>:<port> in environment variables.

See more about Composer environment variables.

Integrating with packagist.org to Auto-update

On Gitlab

  • On the page of the project, go to Settings > Integrations and click on Packagist link option;
  • Fill the Packagist Username and the token;
  • Test settings and Save.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment