Skip to content
Vasil Rangelov edited this page Nov 7, 2016 · 20 revisions

Getting started

Introduction

Allows you to share data across requests as long as the PHP process is running.

Requirements

  • PHP 5.3.9 or later
  • At least one of the following:
    • The APC extension (>= 3.1.1)
    • The APCu extension (>= 5.0.0)
    • The WinCache extension (>= 1.1.0)

Installation

Direct PHAR usage

If you download the ".phar" archive, you can just include the archive, and be ready to go, like for example:

<?php
//You may want to include a namespace declaration here
require_once 'PEAR2_Cache_SHM-0.2.0.phar';
//Use any PEAR2_Cache_SHM class from here on

Installation with Pyrus/PEAR2 (recommended)

Assuming you have installed Pyrus, you can install PEAR2_Cache_SHM from the pear2.php.net channel with

php pyrus.phar install PEAR2_Cache_SHM-alpha

If you've decided to not use the pear2.php.net channel, but instead install directly from the archive distributed at the project page, you can use

php pyrus.phar install /path/to/downloaded/archive.tgz

Installation with PEAR

Like most PEAR2 packages, PEAR2_Cache_SHM is compatible with the PEAR installer. However, you have to first discover the PEAR2 channel with

pear channel-discover pear2.php.net

and only then install PEAR2_Cache_SHM with

pear install pear2/PEAR2_Cache_SHM-alpha

Installation with Composer

This package is available from packagist.org, so all you have to do is to go to your project's directory (where your composer.json is), and run

composer require pear2/cache_shm:*@alpha

Manual installation

This package has no external dependencies (well, not ones written in PHP), so you can just download an archive, and extract the contents of the "src" folder wherever you like. To emulate the PEAR2 installer, you can place the files in a folder that's within your include_path.

Installation from the repository (with Git)

If you want to get the "cutting edge", unpackaged version of PEAR2_Cache_SHM, you'll need to have Git. Once you have it, create a folder to place the package and its dependencies in, navigate to it from the command line, and execute the following command:

git clone https://github.com/pear2/Cache_SHM.git Cache_SHM.git

Note: If you plan to contribute to this project, please use GitHub's "fork" feature instead, and then apply "git clone" on it, instead of the original repository.

Troubleshooting

If the package doesn't work, you can download the "phar" file (maybe rename it from ".phar" to ".php"), and run it in your browser or command line.

When you do that, you should see the version of the package, along with some messages indicating if you're missing any of the requirements. If all requirements are present, you'll see what adapters can you use under the SAPI you're running the file with.