Installation on Linux - chung-leong/qb GitHub Wiki
The preferred installation method in Linux is to compile from source code. Binary packages for selected Linux distros are also available if you wish to avoid the hassle of setting up a development environment.
Compiling QB from source
There are two ways to compile QB: using the full PHP source code or using phpize. The latter method is the one to use if you had obtained PHP through the provider of your Linux distro (i.e. using apt-get, urpmi, or yum).
Compiling QB with phpize
First, make sure phpize is available. In a console, type phpize
. If the response is “command not found,” then phpize is not installed on your computer. phpize is part of the PHP development package. In Debian distros, the package is known as "php5-dev". In distros that use RPM, it is called "php-devel". Install it by running the appropriate command.
Download the QB source tarball and uncompress it. In a console, cd to the directory containing the QB source code. Enter the command phpize
. You should get a response resembling the following:
PHP Api Version: 20090626
Zend Module Api No: 20090626
Zend Extension Api No: 220090626
Enter ./configure --help
. This lists the compilation options available for QB. There are three: --with-cpu
, --with-sse
and –with-avx
. They determine whether the compiler will generate code making use of SIMD instructions on x86 processors. Enabling SIMD yields a small performance boost. Most modern CPUs supports SSE 3. Starting from Core 2, Intel CPUs support SSE 4. --with-cpu
let you specify a CPU family to optimize for. If you specify --with-cpu=native
, gcc will automatically choose the best settings for the current CPU.
Run make
to start the compilation process. Upon completion, you'll find the shared library in the modules
sub-directory. If you wish, you can reduce the size of the file by running strip qb.so
.
Compiling QB with full PHP tarball
This is the method to use if you wish to link QB into PHP statically. If you have not yet done so, download the source tarball from the PHP web site. Extract files in the package to a directory of your choice, then place the QB source code into ext/qb
. Run ./buildconf --force
to update the configuration script, then run ./configure --enable-qb
plus any other additional options (possibly including those mentioned in the preceding section). Finally, run make
to compile PHP.
To compile QB as a shared library instead, use --enable-qb=shared
.
Activating QB
Debian-based Distros (Ubunutu, Mint, etc.)
Copy qb.so into the PHP extension directory. You can learn the location by running php -i | sed -n 's/extension_dir => \(.*\) => .*/\1/p'
.
Copy qb.ini into /etc/php5/mods-available/
.
Run sudo php5enmod qb
.
Red-Hat-based Distros (CentOS, Fedora, etc.)
Copy qb.so into the PHP extension directory. You can learn the location by running php -i | sed -n 's/extension_dir => \(.*\) => .*/\1/p'
.
Copy qb.ini into /etc/php.d/
.
Other Distros
Copy qb.so into the PHP extension directory. You can learn the location by running php -i | sed -n 's/extension_dir => \(.*\) => .*/\1/p'
.
In most Linux distros, the configurations of PHP extensions are stored in separate files in a special directory. You can learn the location by running php --ini | sed -n 's/.*ini files in: \(.*\)/\1/p'
.