First, explain what Yar is. A PHP extension that supports parallel development is developed by Sina's famous bigint bird. Source Address www.laruence.com201209152779.html its feature is that it can efficiently encapsulate the interface for external access, its purpose, you know. How can we use yar of great god in live broadcasting.
First, explain what Yar is. A PHP extension that supports parallel development is developed by Sina's famous bigint bird. Source Address http://www.laruence.com/2012/09/15/2779.html its characteristic is can efficiently encapsulate the interface for external access, use well, you know. How can we use yar of great god in live broadcasting.
First, explain what Yar is.
A PHP extension that supports parallel development is developed by Sina's famous bigint bird.
Source http://www.laruence.com/2012/09/15/2779.html
Its feature is that it can efficiently encapsulate the interfaces for external access. Its purpose is well, you know.
How can we use yar of great god in live broadcasting.
1. download.
Well, that's right. At the bottom of the article, laruence provided github.
However, this is not enough because the framework requiresMsgpackAgain, this is maintained by laruence !!
Ii. msgpack.
Well .....
It seems that the downloaded files are all. c. h files. That's right. We need to compile it ourselves!
1. msgpack
Decompress the package and check README. md.
## Install
### Install from PECL
Msgpack is an PECL extension, thus you can simply install it by:
"`
pecl install msgpack
"`
### Compile Msgpack from source
"`
$/path/to/phpize
$./configure
$make && make install
"`
Well, we found that this can be installed online through pecl.
Open a terminal and enter
pecl install msgpack
Failed. The prompt is as follows:
Failed to download pecl/msgpack within preferred state "stable", latest release is version 0.5.5, stability "beta", use "channel://pecl.php.net/msgpack-0.5.5" to install
install failed
This is because msgpack does not have a stable version. Follow the instructions above to enter
pecl install channel://pecl.php.net/msgpack-0.5.5
Still failed, but prompt changed
WARNING: configuration download directory "/build/buildd/php5-5.5.3+dfsg/pear-build-download" is not writeable. Change download_dir config variable to a writeable dir to avoid this warningCannot install, php_dir for channel "pecl.php.net" is not writeable by the current user
It seems that we do not have the write permission for the folder. Next we switch to the root user and re-execute the above command
Too much content. Cut down the last section.
Build process completed successfully
Installing '/usr/lib/php5/20121212/msgpack.so'
Installing '/usr/include/php5/ext/msgpack/php_msgpack.h'
install ok: channel://pecl.php.net/msgpack-0.5.5
configuration option "php_ini" is not set to php.ini location
You should add "extension=msgpack.so" to php.ini
The following operation is to open the configuration file and write the extension to the file.
sudo gedit /etc/php5/apache2/php.ini
Restart apache
sudo /etc/init.d/apache2 restart
View phpinfo
So far, we have installed the PHP extension of msgpack.
Iii. Yar
Unzip the download yar-master.zip we still look at the README. md file, in fact, directly on github is also the same ....
The installation requirement requires the php extension to be installed. This is the importance of the previous step!
## Requirement
- PHP 5.2+
- Curl
- Json
- Msgpack (Optional)
Install yar
### Install Yar
Yar is an PECL extension, thus you can simply install it by:
"
pecl install yar
"
It seems that we can also install it directly using the pecl command, which seems not so smooth.
downloading yar-1.2.1.tgz ...
Starting to download yar-1.2.1.tgz (35,174 bytes)
.........done: 35,174 bytes
28 source files, building
running: phpize
Configuring for:
PHP Api Version: 20121113
Zend Module Api No: 20121212
Zend Extension Api No: 220121212
building in /tmp/pear/temp/pear-build-rootoSsn5u/yar-1.2.1
running: /tmp/pear/temp/yar/configure
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for PHP prefix... /usr
checking for PHP includes... -I/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/include/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib
checking for PHP extension directory... /usr/lib/php5/20121212
checking for PHP installed headers prefix... /usr/include/php5
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... no
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
checking for gawk... no
checking for nawk... nawk
checking if nawk is broken... no
checking whether to enable yar support... yes, shared
checking for curl protocol support... yes, shared
checking for msgpack packager support... no
checking for cURL in default path... not found
configure: error: Please reinstall the libcurl distribution - easy.h should be in /include/curl/
ERROR: `/tmp/pear/temp/yar/configure' failed
Here we can see that we lack a re2c 0.13.4 or an updated version. In addition, our curl module does not meet the requirements and requires reinstallation.
Solve the problem below!
I found the re2c http://download.csdn.net/download/morre/5702707 in this address and skipped the re2c installation in the solution below, it seems that the above is just a warning, not too big a problem.
Let's go back to yar Compilation
Phpize is required for compilation, so we need to install phpize and install phpize.
yum install php-devel
The returned message is
The program "yum" has not been installed yet. Run the following command to install sudo apt-get install yum:
Well, install yum first, and install phpize. Note that when installing phpize, use
RootUser execution!
Then reinstall the curl library and restart apache.
sudo apt-get install curl libcurl3 libcurl3-dev php5-curl
Sudo/etc/init. d/apache2 restart
Run the pecl installation command again.
Pecl install yar
Then there is no problem. After a short wait, the following prompt is displayed, and the installation is complete!
Build process completed successfully
Installing '/usr/lib/php5/20121212/yar.so'install ok:
channel://pecl.php.net/yar-1.2.1configuration option "php_ini" is not set to php.ini locationYou should add "extension=yar.so" to php.ini
The following steps are the same as the previous one: modify the configuration file and restart apache.
sudo gedit /etc/php5/apache2/php.ini
sudo /etc/init.d/apache2 restart
After the restart, phpinfo does not see the corresponding extension.