PHP and Http Extension
PHPandHttpExtension
RecentlyIamtestingtheperformanceforPHP.Ijustsawavery‘easy’exceptionssayhttp\Urlclassnotfound.Iwasthinkingitiseasytofixthisanditisjustatypoorwrongname.
ButIamwrong,itisrelatedtothisextensioninPHPhttps://mdref.m6w6.name/ItisPECL/http
Firstofall,IamusingCentOS7,IamusingPHP5.6,Iamusingdocker.Thatbringsalotofenvironmentsettingupissuesforme.
HereistheDockerfile,thatisthemostimportantthingstobuildtheENV.
#RunaSimpleRESTAPIbasedonplayframework
#PrepretheOS
FROMcentos:7
MAINTAINERCarlLuo<[email protected]>
ENVDEBIAN_FRONTENDnoninteractive
ENVPERL_MM_USE_DEFAULT1
ENVAWS_PHP_CACHE_DIR/tmp/awscache
RUNyuminstall-ygccmakewget
RUNyuminstall-ymysql-devel
RUNmkdir/install/
WORKDIR/install/
#installperl
RUNwgethttp://www.cpan.org/src/5.0/perl-5.16.3.tar.gz
RUNtarzxvfperl-5.16.3.tar.gz
WORKDIR/install/perl-5.16.3
RUN./Configure-des-Dusethreads
RUNmake&&makeinstall
RUNcpan-fiLog::Log4perlYAML::XSData::DumperDBIIOCRedisTime::PiecePath::Class
RUNcpan-fiautodieThread::Queuethreads
RUNcpan-fiDBIx::Connector
RUNcpanDBD::mysql
#installphp5.6
RUNrpm-Uvhhttps://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
RUNrpm-Uvhhttps://mirror.webtatic.com/yum/el7/webtatic-release.rpm
RUNrpm-Uvhhttp://rpms.famillecollet.com/enterprise/remi-release-7.rpm
RUNyuminstall-yphp56w
RUNyuminstall-yphp56w-mysqlnd
RUNyuminstall-yphp56w-common
RUNyuminstall-yphp56w-devel
RUNyum--enablerepo=remi,remi-php56install-yphp-pear
RUNyuminstall-yphp56-php-raphf
#setupphp
ADDconf/php.ini/etc/php.ini
RUNecho"usr/\n"|peclinstallpecl_http-2.5.6
#InstalltheApplication
RUNmkdir/share/
WORKDIR/share/
ADDdist/jobs-consumerphp-1.0.tgz/share/
RUNmkdir-p/share/jobs-consumerphp-1.0/logs
#StarttheApplication
RUNmkdir-p/app/
RUNmkdir-p/tmp/awscache
ADDstart.sh/app/
WORKDIR/app
CMD["./start.sh"]
AndrememberthatIhavetheselinesinorderinphp.initomakeitworking.
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/