2023年7月3日发(作者:)
常⽤的php扩展mimemagic,教训为php添加⼀些常⽤扩展⼀、添加scws扩展2、编译安装scws先安装⼀些编译依赖包#yum install gcc gcc-c++ make -y#tar xf 2#mkdir -pv /opt/app/ #软件统⼀安装到/opt/app ⽬录#cd scws-1.2.3/#./configure --prefix=/opt/app/scws# make && make install #确保没有报错查看是否安装ok#ll /opt/app/scws/lib/total 140-rwxr-xr-x 1 root root 914 Dec 21 2016 rwxrwx 1 root root 16 Dec 21 2016 -> .1.1.0lrwxrwxrwx 1 root root 16 Dec 21 2016 .1 -> .1.1.0-rwxr-xr-x 1 root root 136894 Dec 21 2016 .1.1.0试试执⾏ scws⽂件#/opt/app/scws/bin/scws -hscws (scws-cli/1.2.3)Simple Chinese Word Segmentation - Command line ght (C)2007 by hightman.3、开始为php安装scws扩展#cd scws-1.2.3/phpext/ #⼀定要先切换到这个表,否则执⾏失败#/opt/app/php7/bin/phpizeConfiguring for:PHP Api Version: 20151012Zend Module Api No: 20151012Zend Extension Api No: 320151012#./configure --with-php-config=/opt/app/php7/bin/php-config --with-scws=/opt/app/scws为php7添加scws扩展#make#make installInstalling shared extensions: /opt/app/php7/lib/php/extensions/no-debug-non-zts-20151012/会告知模块安装的路径4、在php7的配置⽂件中添加scws扩展模块#cd /opt/app/php7/etc#vim …………extension_dir = "/opt/app/php7/lib/php/extensions/no-debug-non-zts-20151012" #添加路径[redis]extension = nsion = nsion = ;extension = ;e_eval = On##添加如下模块###[scws]extension = t = = /opt/app/scws/etc然后重启php7使其加载该模块#kill -usr2 `cat /opt/app/php7/var/run/` #重启php7⼆、php5和php7配置⽂件php5#cat etc/[global]pid = run/or_log = log/[www]user = httpdgroup = httpdlisten = 127.0.0.1:9000pm = _children = _servers = _spare_servers = _spare_servers = _requests = 5000rlimit_files = 65535#############################cat etc/[PHP]engine = Onshort_open_tag = Onasp_tags = Offprecision = 14y2k_compliance = Onoutput_buffering = _compression = Offimplicit_flush = Offunserialize_callback_func =serialize_precision = 100allow_call_time_pass_reference = Offsafe_mode = Onsafe_mode_gid = Offsafe_mode_include_dir =safe_mode_exec_dir = /opt/case/phpincsafe_mode_allowed_env_vars = PHP_safe_mode_protected_env_vars = LD_LIBRARY_PATHdisable_functions = "exec,passthru,system,shell_exec,proc_open,proc_close,proc_get_status,proc_nice,proc_terminate,popen,pdisable_classes =expose_php = Offmax_execution_time = 60max_input_time = 60memory_limit = 256Merror_reporting = E_ALL & ~E_DEPRECATED & ~E_NOTICEdisplay_errors = Offdisplay_startup_errors = Offlog_errors = On;error_log = "/opt/logs/php5/"log_errors_max_len = 1024ignore_repeated_errors = Offignore_repeated_source = Offreport_memleaks = Ontrack_errors = Offhtml_errors = Offvariables_order = "GPCS"request_order = "GP"register_globals = Offregister_long_arrays = Offregister_argc_argv = Offauto_globals_jit = Onpost_max_size = 200Mmagic_quotes_gpc = Offmagic_quotes_runtime = Offmagic_quotes_sybase = Offauto_prepend_file =auto_append_file =default_mimetype = "text/html"include_path = ".:/opt/case/phpinc"doc_root =user_dir =enable_dl = Offfile_uploads = Onupload_max_filesize = 200Mmax_file_uploads = 20allow_url_fopen = Onallow_url_include = Offdefault_socket_timeout = 60extension_dir = "/opt/app/php5/lib/php/extensions/no-debug-non-zts-20090626"[redis]extension = nsion = ;extension = ;e_eval = On[scws]extension = t = = /opt/app/scws/etc[Date]ne = "Asia/Shanghai"[filter][iconv][intl][sqlite][sqlite3][Pcre][Pdo][Pdo_mysql]pdo__size = 2000pdo_t_socket=[Phar][Syslog]define_syslog_variables = Off[mail function]SMTP = localhostsmtp_port = _x_header = On[SQL]_mode = Off[ODBC]_persistent = _persistent = _persistent = -_links = -tlrl = tbinmode = 1[Interbase]_persistent = _persistent = -_links = -ampformat = "%Y-%m-%d %H:%M:%S"rmat = "%Y-%m-%d"rmat = "%H:%M:%S"[MySQL]_local_infile = _persistent = _size = _persistent = -_links = -t_port =t_socket =t_host =t_user =t_password =t_timeout = _mode = Off[MySQLi]_persistent = -_persistent = _links = -_size = t_port = t_socket =t_host =t_user =t_pw =ect = Off[mysqlnd]t_statistics = t_memory_statistics = Off[OCI8][PostgresSQL]_persistent = _reset_persistent = _persistent = -_links = -_notice = _notice = 0[Sybase-CT]_persistent = _persistent = -_links = -_server_severity = _client_severity = 10[bcmath] = 0[browscap][Session]_handler = _path = "tcp://:6379?auth=passwd_redis"_cookies = _only_cookies = = _start = _lifetime = _path = /_domain =_httponly =ize_handler = _probability = _divisor = _maxlifetime = _compat_42 = _compat_warn = r_check =y_length = _limiter = _expire = _trans_sid = _function = _bits_per_character = 5url_ = "a=href,area=href,frame=src,input=src,form=fakeentry"[MSSQL]_persistent = _persistent = -_links = -_error_severity = _message_severity = ability_mode = _connection = Off[Assertion][COM][mbstring][gd][exif][Tidy]_output = Off[soap]_cache_enabled=_cache_dir="/tmp"_cache_ttl=_cache_limit = 5[sysvshm][ldap]_links = -1[mcrypt][dba][opcache];zend_extension = /opt/app/php5/lib/php/extensions/no-debug-non-zts-20090626/; = 1;_cli=1;_consumption=512;ed_strings_buffer=8;_accelerated_files=6000;date_freq=60;_shutdown=1;_comments=0;_file_override=1######################################3php7#cat [global]pid = run/or_log = log/[www]user = httpdgroup = httpdlisten = 127.0.0.1:9001pm = _children = _servers = _spare_servers = _spare_servers = _requests = 5000rlimit_files = 65535########################################33#cat [PHP]engine = Onshort_open_tag = Onasp_tags = Offprecision = 14y2k_compliance = Onoutput_buffering = _compression = Offimplicit_flush = Offunserialize_callback_func =serialize_precision = 100allow_call_time_pass_reference = Off;safe_mode = Onsafe_mode_gid = Offsafe_mode_include_dir =safe_mode_exec_dir = /opt/case/phpincsafe_mode_allowed_env_vars = PHP_safe_mode_protected_env_vars = LD_LIBRARY_PATHdisable_functions = "exec,passthru,system,shell_exec,proc_open,proc_close,proc_get_status,proc_nice,proc_terminate,popen,pdisable_classes =expose_php = Offmax_execution_time = 30max_input_time = 60memory_limit = 256Merror_reporting = E_ALL & ~E_DEPRECATED & ~E_NOTICEdisplay_errors = Offdisplay_startup_errors = Offlog_errors = Onerror_log = "/opt/logs/php7/"log_errors_max_len = 1024ignore_repeated_errors = Offignore_repeated_source = Offreport_memleaks = Ontrack_errors = Offhtml_errors = Offvariables_order = "GPCS"request_order = "GP"register_globals = Offregister_long_arrays = Offregister_argc_argv = Offauto_globals_jit = Onpost_max_size = 200Mmagic_quotes_gpc = Offmagic_quotes_runtime = Offmagic_quotes_sybase = Offauto_prepend_file =auto_append_file =default_mimetype = "text/html"include_path = ".:/opt/case/phpinc"doc_root =user_dir =enable_dl = Offfile_uploads = Onupload_max_filesize = 200Mmax_file_uploads = 20allow_url_fopen = Onallow_url_include = Offdefault_socket_timeout = 60extension_dir = "/opt/app/php7/lib/php/extensions/no-debug-non-zts-20151012/"[redis]extension = nsion = [scws]extension = t = = /opt/app/scws/etc[Date]ne = "Asia/Shanghai"[filter][iconv][intl][sqlite][sqlite3][Pcre][Pdo][Pdo_mysql]pdo__size = 2000pdo_t_socket=[Phar][Syslog]define_syslog_variables = Off[mail function]SMTP = localhostsmtp_port = _x_header = On[SQL]_mode = Off[ODBC]_persistent = _persistent = _persistent = -_links = -tlrl = tbinmode = 1[Interbase]_persistent = _persistent = -_links = -ampformat = "%Y-%m-%d %H:%M:%S"rmat = "%Y-%m-%d"rmat = "%H:%M:%S"[MySQL]_local_infile = _persistent = _size = _persistent = -_links = -t_port =t_socket =t_host =t_user =t_password =t_timeout = _mode = Off[MySQLi]_persistent = -_persistent = _links = -_size = t_port = t_socket =t_host =t_user =t_pw =ect = Off[mysqlnd]t_statistics = t_memory_statistics = Off[OCI8][PostgresSQL]_persistent = _reset_persistent = _persistent = -_links = -_notice = _notice = 0[Sybase-CT]_persistent = _persistent = -_links = -_server_severity = _client_severity = 10[bcmath] = 0[browscap][Session]_handler = _path = "tcp://:6379?auth=passwd_redis"_cookies = _only_cookies = = _start = _lifetime = _path = /_domain =_httponly =ize_handler = _probability = _divisor = _maxlifetime = _compat_42 = _compat_warn = r_check =y_length = _limiter = _expire = _trans_sid = _function = _bits_per_character = 5url_ = "a=href,area=href,frame=src,input=src,form=fakeentry"[MSSQL]_persistent = _persistent = -_links = -_error_severity = _message_severity = ability_mode = _connection = Off[Assertion][COM][mbstring][gd][exif][Tidy]_output = Off[soap]_cache_enabled=_cache_dir="/tmp"_cache_ttl=_cache_limit = 5[sysvshm][ldap]_links = -1[mcrypt][dba][opcache];zend_extension = /opt/app/php7/lib/php/extensions/no-debug-non-zts-20151012/; = 1;_cli=1;_consumption=512;ed_strings_buffer=8;_accelerated_files=6000;date_freq=60;_shutdown=1;_comments=0;_file_override=1#tar xf 2#cd redis-2.2.8#/opt/app/php5/bin/phpize#./configure --with-php-config=/opt/app/php5/bin/php-config#make#make install查看#ls -l /opt/app/php5/lib/php/extensions/no-debug-non-zts-20090626/然后将扩展模块添加到 中#vim ension_dir = "/opt/app/php5/lib/php/extensions/no-debug-non-zts-20090626/"[redis]extension = #添加了redis和mongodb模块extension = 然后重启php进程使其⽣效#kill -usr2 `cat /opt/app/php5/var/run/` #重启php5三、为php添加swoole扩展Swoole是⼀种PHP⾼级Web开发框架,框架不是为了提升⽹站的性能,是为了提升⽹站的开发效率。最少的性能损耗,换取最⼤的开发效率。利⽤Swoole框架,开发⼀个复杂的Web功能,可以在很短的时间内完成了2、swoole和php版本对应关系swoole版本和匹配的php版本对应关系如下图:连接:注意:如果不匹配,编译就会报错如下:/opt/src/swoole-src/php_swoole.h:147:2: error: #error "require PHP version 5.5 or later."make: *** [] Error 1因为我php是5.3.10,所以下载1.9.19版本的swoole!开始安装#tar xf #cd swoole-1.9.19#/opt/app/php5/bin/phpizeConfiguring for:PHP Api Version: 20090626Zend Module Api No: 20090626Zend Extension Api No: 220090626#./configure#make && make installInstalling shared extensions: /opt/app/php5/lib/php/extensions/no-debug-non-zts-20090626/Installing header files: /opt/app/php5/include/php/4、查看so⽂件# ll /opt/app/php5/lib/php/extensions/no-debug-non-zts-20090626/total 3924-rwxr-xr-x 1 root root 845258 Feb 3 2016 -rwxr-xr-x 1 root root 3167018 Sep 4 12:23 5、在中开启添加#vi ension_dir = "/opt/app/php5/lib/php/extensions/no-debug-non-zts-20090626"[swoole]extension = 6、如果是php-fpm启动的PHP,重启php-fpm查看#/opt/app/php5/bin/php -m | grep swooleswoole添加完成,测试ok即可!注意:在php7执⾏configure的时候报错configure: error: Cannot find php-config. Please use --with-php-config=PATH添加路径即可:./configure --with-php-config=/opt/app/php7/bin/php-config#########################################################补充:在实际环境中,开发要求swoole模块需要⽀持ssl和nghttp2,使⽤configure --help查看得到,可以在编译的时候,加⼊这2个参数,于是,编译参数变成了:⾸先安装依赖包#yum install openssl openssl-devel libnghttp2 libnghttp2-devel nghttp2 -y重新编译#cd swoole-1.9.19#./configure --with-php-config=/opt/app/php7/bin/php-config --enable-openssl --enable-http2#make结果报错如下:In file included from /home/xingliguang/swoole-1.9.19/swoole.c:16:/home/xingliguang/swoole-1.9.19/php_swoole.h:142:2: error: #error "Enable http2 support, require nghttp2 library."make: *** [] Error 1提⽰需要nghttp2 library,但是nghttp2明明已经安装了,真是太奇怪了,后来在⽹上找了很多资料,参考着操作,最后成功编译,操作如下:#ldconfig#cd swoole-1.9.19#vi config.h#define HAVE_NGHTTP2 1 #加⼊此⾏创建软连接:#ln -sv /usr/lib64/ /usr/local/lib64/#ln -sv /usr/lib64/.14 /usr/local/lib64/.14#ln -sv /usr/lib64/.14.4.0 /usr/local/lib64/.14.4.0查看# ll /usr/local/lib64/total 0lrwxrwxrwx 1 root root 24 Sep 11 15:46 -> /usr/lib64/rwxrwx 1 root root 27 Sep 11 15:49 .14 -> /usr/lib64/.14lrwxrwxrwx 1 root root 31 Sep 11 15:49 .14.4.0 -> /usr/lib64/.14.4.0重新执⾏make就不会报错了,然后执⾏make install然后在配置⽂件中添加 并重启php进程即可。#############################################################过了⼏天开发⼜提需求了,需要加上--enable-async-redis --enable-sockets2个参数,但是编译出错如下:/home/xingliguang/swoole-1.9.19/swoole_redis.c:20:29: error: hiredis/hiredis.h: No such file or directory/home/xingliguang/swoole-1.9.19/swoole_redis.c:21:27: error: hiredis/async.h: No such file or directory⽹上说是要安装redis,但是我们已经源码⽅式安装了reidis于是找到了这2个⽂件:#ll /opt/app/redis/deps/hiredis/async.h-rw-rw-r-- 1 root root 5021 Dec 18 2015 /opt/app/redis/deps/hiredis/async.h#ll/opt/app/redis/deps/hiredis/hiredis.h-rw-rw-r-- 1 root root 9403 Dec 18 2015 /opt/app/redis/deps/hiredis/hiredis.h所以添加编译参数重新编译就不报错了,如下:#./configure --with-php-config=/opt/app/php7/bin/php-config --enable-openssl --enable-http2 --enable-async-redis=/opt/app/redis --enable-sockets#make#make installXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX但是过了2天开发⼈员说swoole模块不能使⽤hiredis的功能,我凌乱了,原来不能使⽤这个参数--enable-async-redis=/opt/app/redis ,不能跟后⾯的路径。于是从gitlab下载了hiredis的源码包#mv master #ll-rw-r--r-- 1 root root 90950 Sep 25 15:09 解压之后开始编译安装#unzip #cd hiredis-master#make#make install安装好之后,就会在/usr/local/lib⽬录下⽣成so⽂件,如下:#ll /usr/local/libtotal 556-rw-r--r-- 1 root root 332286 Sep 25 15:10 wxrwx 1 root root 18 Sep 25 15:10 -> .0.13-rwxr-xr-x 1 root root 227445 Sep 25 15:10 .0.13drwxr-xr-x 2 root root 4096 Sep 25 15:10 pkgconfig因为系统默认是去/usr/lib64/中加载*.so⽂件,⽽我们编译安装hiredis之后,⽣成的so⽂件在/usr/local/lib⽬录下⾯,所以创建⼀个软链接#ln -sv /usr/local/lib/.0.13 /usr/lib64/#ldconfig然后重新编译安装swoole扩展#tar xf 2#cd swoole-1.9.19#/opt/app/php7/bin/phpize#./configure --with-php-config=/opt/app/php7/bin/php-config --enable-openssl --enable-http2 --enable-async-redis --enable-sockets#make#make install然后就可以查到swoole扩展了#/opt/app/php7/bin/php -m | grep swoole整理后的安装步骤:php7.0 安装swoole#yum install openssl openssl-devel libnghttp2 libnghttp2-devel nghttp2 -y#mv master #ll-rw-r--r-- 1 root root 90950 Sep 25 15:09 解压之后开始编译安装#unzip #cd hiredis-master#make#make install安装好之后,就会在/usr/local/lib⽬录下⽣成so⽂件,如下:#ll /usr/local/libtotal 556-rw-r--r-- 1 root root 332286 Sep 25 15:10 wxrwx 1 root root 18 Sep 25 15:10 -> .0.13-rwxr-xr-x 1 root root 227445 Sep 25 15:10 .0.13drwxr-xr-x 2 root root 4096 Sep 25 15:10 pkgconfig因为系统默认是去/usr/lib64/中加载*.so⽂件,⽽我们编译安装hiredis之后,⽣成的so⽂件在/usr/local/lib⽬录下⾯,所以创建⼀个软链接#ln -sv /usr/local/lib/.0.13 /usr/lib64/#ldconfig安装swoole#tar xf 2#cd swoole-1.9.19#/opt/app/php7/bin/phpize#./configure --with-php-config=/opt/app/php7/bin/php-config --enable-openssl --enable-http2 --enable-async-redis --enable-sockets#make#make install修改配置⽂件#vim ension = 然后就可以查到swoole扩展了#/opt/app/php7/bin/php -m | grep swoole四、为php添加tideways扩展适⽤范围:PHP 5.3, 5.4, 5.5, 5.6 or 7.0#cd php-profiler-extension#phpize#./configure#make#make install在中添加extension=_prepend_library=0重启php进程⽣效。五、为php添加rabbitmq扩展下载地址安装依赖#yum install librabbitmq librabbitmq-devel -y#tar xf #cd amqp-1.9.1#phpize#./configure --with-php-config=/opt/app/php7/bin/php-config#make#make install在中添加extension_dir = "/opt/app/php7/lib/php/extensions/no-debug-non-zts-20151012"extension = 然后重启php进程查看此模块是否加载#php -m | grep #如果过滤到,说明加载ok六、为php添加soap扩展注意:如果php是编译安装,则需要编译添加扩展,如果是yum安装,可以直接yum添加扩展!描述:⼀台服务器上php没有soap扩展,需要配置。php之前是编译安装的,于是查看了编译参数,发现没有添加--enable-soap 所以soap模块没有被编译进去。于是我直接yum 安装了php-soap,并拷贝到对应的⽬录,如下#cp /usr/lib64/php/modules/ /opt/app/php5/lib/php/extensions/no-debug-non-zts-20090626重启了php-fpm进程,通过#php -m | grep soap 也查到了soap模块,但是开发调⽤的时候依然报错如下:调⽤new SoapClient() 的时候 报502于是通过编译添加soap扩展的⽅式,才解决问题,步骤如下:#tar xf 2#cd php-5.3.10-e-dos/ext/soap#/opt/app/php5/bin/phpize#./configure --with-php-config=/opt/app/php5/bin/php-config#make#make install查看⽣成的⽂件# ll /opt/app/php5/lib/php/extensions/no-debug-non-zts-20090626total 5116-rwxr-xr-x 1 root root 1111652 Sep 21 14:00 然后在配置⽂件添加#cat ension_dir = "/opt/app/php5/lib/php/extensions/no-debug-non-zts-20090626"extension = 重启php-fpm 就ok了七、为php7添加inotify和yac扩展1、⾸先下载2、开始编译#tar xf #cd yac-2.0.2#/opt/app/php7/bin/phpize#./configure --with-php-config=/opt/app/php7/bin/php-config#make#make install#ll /opt/app/php7/lib/php/extensions/no-debug-non-zts-20151012/#vi /opt/app/php7/etc/ension = ############################tar xf #cd inotify-2.0.0#/opt/app/php7/bin/phpize# ./configure --with-php-config=/opt/app/php7/bin/php-config#make#make install#ll /opt/app/php7/lib/php/extensions/no-debug-non-zts-20151012/#vi /opt/app/php7/etc/ension = 重启php7的php-fpm进程,然后查看#/opt/app/php7/bin/php -m⼋、⼀个php7.1安装脚本#cat php7.1_#!/bin/bash##===========================================================# Description: Centos6.7下php7.1安装,且安装php常⽤扩展8个#===========================================================# Name: php7_# Author: wangbo@# Date: 2017-03-28# Version: V1.0# ChangeLog:#===========================================================down_ip=":88"parkage=(php-7.1.10)soft_dir="/opt/app/php7.1"result_check(){if [[ $? -eq 0 ]];thenecho -e "033[01;32m$1 install is finished033[00m."elseecho -e "033[01;31m$1 install stoped033[00m." && continuefi}php_install(){yum -y install freetype-devel libcurl-devel libjpeg-turbo-devel libmcrypt-devel libpng-devel libxml2-devel php-gd openssl-develconfig="./configure --prefix=${soft_dir} --disable-ipv6 --enable-dba --enable-ftp --enable-magic-quotes --enable-mbstring --enable-sockets --enable-pcntl --enable-fpm --enable-zip --enable-bcmath --with-config-file-path=${soft_dir}/etc --with-curl --with-freetype-dir --with-gd --with-jpeg-dir --with-mcrypt --with-mhash --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-openssl --with-pdo-mysql=mysqlnd --with-zlib"tar xvf $2 && cd $1/ && $config && make && make install}if_exist(){echo -e "033[01;32m$1 download is finished,install 033[00m."sleep 1cd /opt/src && rm -rf ./$1}_post_php(){grep -q httpd /etc/passwd || useradd -u2000 -s /sbin/nologin httpdmkdir /opt/logs/php7.1/ -p && chown httpd. /opt/logs/php7.1/ -R# grep -q "php7.1/sbin/php-fpm" /etc/ || echo "${soft_dir}/sbin/php-fpm" >> /etc/}_ext_install(){exts=(amqp-1.9.1apcu-5.1.8inotify-2.0.0mongodb-1.3.0redis-3.1.4tideways-masteryac-2.0.2)ext_config="./configure --with-php-config=${soft_dir}/bin/php-config"yum install librabbitmq-devel libnghttp2-devel -yfor hi in hiredis-master;docd /opt/src/php_ext && tar xvf ${hi}.tgz && cd ${hi} && make && make install && ln -sv /usr/local/lib/.0.13 /usr/lib64/donefor swoole in swoole-1.9.21;docd /opt/src/php_ext && tar xvf ${swoole}.tgz && cd ${swoole} && ${soft_dir}/bin/phpize && ${ext_config} --enable-openssl --enable-http2 --enable-async-redis --enable-sockets --enable-swoole && make && make installdonefor i in ${exts[@]};docd /opt/src/php_ext && tar xvf $ && cd $i && ${soft_dir}/bin/phpize && ${ext_config} && make && make installls -l ${soft_dir}/lib/php/extensions/no-debug-non-zts-20160303/done}_main(){yum -y install cmake gcc-c++ epel-releasemkdir /opt/src -pfor i in ${parkage[@]};do[[ ! -d ${soft_dir} ]] && if_exist $i && php_install $iresult_check $i_post_php && _ext_installdone}_main九、为php 添加stomp 扩展介绍:This extension allows php applications to communicate with any Stomp compliant Message Brokers through easy object oriented anphp7#cd stomp-2.0.1#/opt/app/php7/bin/phpize#./configure --with-php-config=/opt/app/php7/bin/php-config --enable-stomp# ll /opt/app/php7/lib/php/extensions/no-debug-non-zts-20151012/-rwxr-xr-x 1 root root 179275 Dec 18 16:42 #vi /opt/app/php7/etc/[stomp]extension = sto重启#kill -usr2 `cat /opt/app/php7/var/run/`#/opt/app/php7/bin/php -m⽤ 来为php5 添加扩展,make的时候报错,猜测是版本太⾼,于是下载 来为php5 添加扩展,就不会有问题了⼗、为php7.1 安装intl扩展和imagick1、安装intl扩展#cd /opt/src/php-7.1.10/ext/intl#/opt/app/php7.1/bin/phpize#yum install libicu-devel -y#./configure --with-php-config=/opt/app/php7.1/bin/php-config#make#make install2、安装imagick扩展说明:imagick是⼀个PHP的扩展,⽤ImageMagick提供的API来进⾏图⽚的创建与修改,不过这些操作已经包装到扩展imagick中去了,最终调⽤的是ImageMagick提供的API由于安装imagick扩展时需要依赖ImageMagick的函数库,因此必须要先安装ImageMagick官⽅⽂档:First of all download a tar image of the ImageMagick install from here:/projects/imagemagick/files/Unpack it and then from terminal issue the following commands inquotes:步骤1.#cd ImageMagick-6.5.72.#./configure --prefix=/opt/app/imagemagick3.#make && make installFirst of all we need to get the right file and we can get that from here:/package/imagick/downloadAt current writing the latest stable version is the tar file and then enter the commands in quotes in terminal:1.#cd imagick-2.2.32.#/opt/app/php7.1/bin/phpize3.#./configure --with-php-config=/opt/app/php7.1/bin/php-config --with-imagick=/opt/app/imagemagick5.#make && make install注意:如果make报错,可以执⾏export PKG_CONFIG_PATH=/opt/app/imagemagick/lib/pkgconfig然后重新configure修改php7.1 配置⽂件#vi ension = nsion = #vi ension = nsion = ⼗⼀、为php5 添加ssh2模块和 为php7 添加soap模块#tar xf #cd ssh2-0.13#/opt/app/php5/bin/phpize#./configure --with-php-config=/opt/app/php5/bin/php-configmakemake install将模块添加到 和 重启php5 即可#cd /opt/src/php-7.0.12/ext/soap#/opt/app/php7/bin/phpize#./configure --with-php-config=/opt/app/php7/bin/php-config --enable-soap#make#make install将模块添加到 和 重启php7 即可⼗⼆、为php7添加imap扩展yum install libc-client-devel -y#cd php-7.0.12/ext/imap/#/opt/app/php7/bin/phpize#./configure --with-php-config=/opt/app/php7/bin/php-config --with-imap --with-imap-ssl --with-kerberos#make && make install添加到配置⽂件⼗三、gd扩展⽀持jgeg#/ext/gd#/opt/app/php7.4/bin/phpize#yum install libjpeg libjpeg-devel freetype freetype-devel -y#./configure --with-freetype --with-jpeg --with-php-config=/opt/app/php7.4/bin/php-config#make && make install
发布者:admin,转转请注明出处:http://www.yc00.com/news/1688379714a129225.html
评论列表(0条)