`
sillycat
  • 浏览: 2543171 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

PHP and Http Extension

 
阅读更多
PHP and Http Extension

Recently I am testing the performance for PHP. I just saw a very ‘easy’ exceptions say http\Url class not found. I was thinking it is easy to fix this and it is just a typo or wrong name.

But I am wrong, it is related to this extension in PHP https://mdref.m6w6.name/  It is PECL/http

First of all, I am using CentOS7, I am using PHP5.6, I am using docker. That brings a lot of environment setting up issues for me.

Here is the Dockerfile, that is the most important things to build the ENV.
#Run a Simple REST API based on playframework

#Prepre the OS
FROM            centos:7
MAINTAINER      Carl Luo <luohuazju@gmail.com>

ENV             DEBIAN_FRONTEND noninteractive
ENV             PERL_MM_USE_DEFAULT 1
ENV AWS_PHP_CACHE_DIR /tmp/awscache

RUN             yum install -y gcc make wget
RUN             yum install -y mysql-devel
RUN             mkdir /install/
WORKDIR         /install/

#install perl
RUN             wget http://www.cpan.org/src/5.0/perl-5.16.3.tar.gz
RUN             tar zxvf perl-5.16.3.tar.gz
WORKDIR         /install/perl-5.16.3
RUN             ./Configure -des -Dusethreads
RUN             make && make install
RUN             cpan -fi Log::Log4perl YAML::XS Data::Dumper DBI IOC Redis Time::Piece Path::Class
RUN             cpan -fi autodie Thread::Queue threads
RUN             cpan -fi DBIx::Connector
RUN             cpan DBD::mysql

#install php5.6
RUN  rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
RUN         rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
RUN             rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
RUN          yum install -y php56w

RUN         yum install -y php56w-mysqlnd
RUN             yum install -y php56w-common
RUN             yum install -y php56w-devel
RUN             yum --enablerepo=remi,remi-php56 install -y php-pear

RUN             yum install -y php56-php-raphf

#set up php
ADD             conf/php.ini /etc/php.ini

RUN             echo "usr/\n" | pecl install pecl_http-2.5.6

#Install the Application
RUN             mkdir /share/
WORKDIR         /share/
ADD             dist/jobs-consumerphp-1.0.tgz /share/
RUN             mkdir -p /share/jobs-consumerphp-1.0/logs

#Start the Application
RUN     mkdir -p /app/
RUN     mkdir -p /tmp/awscache
ADD     start.sh /app/
WORKDIR /app
CMD [ "./start.sh" ]

And remember that I have these lines in order in php.ini to make it working.
extension=iconv.so
extension=raphf.so
extension=propro.so
extension=http.so

References:
http://stackoverflow.com/questions/21077976/pecl-http-failed-to-load

http://stackoverflow.com/questions/19517095/struggling-to-install-php-pecl-on-centos

https://support.rackspace.com/how-to/install-epel-and-additional-repositories-on-centos-and-red-hat/

https://webtatic.com/packages/php56/
http://rpms.famillecollet.com/enterprise/7/

http://monoclechronicles.net/unable-to-load-http-so/
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics