简介:
php 7.4.30 安装并使用阿里云视频直播SDK示例
安装PHP
根目录下执行如下命令行:
mkdir /data cd /data
yum安装依赖
yum install -y wget yum install -y gcc-c++ yum install -y openssl-devel yum install -y sqlite-devel yum install -y libcurl-devel yum install -y libjpeg-devel yum install -y libicu-devel yum install -y gcc automake autoconf libtool make
编译安装依赖
// 安装依赖 yum -y install freetype freetype-devel krb5-devel openldap openldap-devel libpng-devel libxslt-devel libxml2 libxml2-devel // 安装onig-6.8.2: cd /data/ wget https://github.com/kkos/oniguruma/releases/download/v6.8.2/onig-6.8.2.tar.gz tar -zxvf onig-6.8.2.tar.gz cd onig-6.8.2/ ./configure --prefix=/usr --libdir=/lib64 --disable-dependency-tracking make && make install // 手动安装libzip (>=0.11) https://blog.csdn.net/tootsy_you/article/details/123132164 cd /data wget https://libzip.org/download/libzip-1.3.2.tar.gz --no-check-certificate tar zxf libzip-1.3.2.tar.gz cd libzip-1.3.2/ ./configure && make && make install // 查看libzip位置(检验) whereis libzip // 配置libzip库,使configure可以找到它 export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig/"
注:从libzip1.4.0版本以上需要cmake编译安装,而且对cmake也有版本依赖,大部分情况需要先安装对应版本cmake,无特殊需求,1.3.2即可。
安装PHP
下载php
// https://www.php.net/releases/ 中寻找对应的php版本 cd /data wget https://www.php.net/distributions/php-7.4.30.tar.gz tar -zxvf php-7.4.30.tar.gz cd php-7.4.30/ yum install -y php-mcrypt libmcrypt libmcrypt-devel autoconf freetype gd jpegsrc libmcrypt libpng libpng-devel libjpeg libxml2 libxml2-devel zlib curl curl-devel12 mv /data/php-7.4.30/ext/openssl/config0.m4 /data/php-7.4.30/ext/openssl/config.m4
编译
./configure \ --prefix=/usr/local/php \ --with-config-file-path=/usr/local/php/etc \ --enable-mysqlnd \ --with-mysqli=mysqlnd \ --with-pdo-mysql=mysqlnd \ --enable-pdo \ --with-iconv-dir \ --with-freetype \ --with-jpeg \ --with-zlib \ --enable-xml \ --enable-session \ --disable-rpath \ --enable-bcmath \ --enable-shmop \ --enable-sysvsem \ --enable-inline-optimization \ --with-curl \ --enable-mbregex \ --enable-mbstring \ --enable-intl \ --enable-pcntl \ --enable-bcmath \ --enable-ftp \ --enable-gd \ --with-openssl \ --with-mhash \ --enable-pcntl \ --enable-sockets \ --with-xmlrpc \ --with-zip \ --enable-soap \ --with-gettext \ --disable-fileinfo \ --enable-opcache \ --enable-maintainer-zts \ --with-xsl \ --enable-tokenizer \ --enable-fpm
安装
make && make install
如果遇到如下问题:
/data/php-7.4.30/ext/standard/array.c: In function 'zif_array_sum': /data/php-7.4.30/Zend/zend_operators.h:674:2: error: invalid 'asm': invalid operand prefix '%c'
解决方法:
修改这里二个Zend/zend_operators.h文件中ZEND_USE_ASM_ARITHMETIC 值均为0即可
# define ZEND_USE_ASM_ARITHMETIC 1 #else # define ZEND_USE_ASM_ARITHMETIC 0 #endif
然后重新安装即可。
安装完成之后检验
检验安装是否正常:
/usr/local/php/bin/php --version
加软连接:
ln -s /usr/local/php/bin/php /usr/local/bin
PHP引入阿里云视频直播SDK示例
安装composer
$ curl -sS https://getcomposer.org/installer | php $ mv composer.phar /usr/local/bin/composer $ composer config -g repo.packagist composer http://mirrors.aliyun.com/composer/
引入alibabacloud/sdk
到项目根目录下:
$ composer init $ composer require alibabacloud/live
附件:
安装执行步骤+示例代码