常⽤的php扩展mimemagic,教训为php添加⼀些常⽤扩
⼀、添加scws扩展
2、编译安装scws
先安装⼀些编译依赖包
#yum install gcc gcc-c++ make  -y
#tar xf scws-1.2.3.tar.bz2
#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 libscws.la
lrwxrwxrwx 1 root root    16 Dec 21  2016 libscws.so -> libscws.so.1.1.0
lrwxrwxrwx 1 root root    16 Dec 21  2016 libscws.so.1 -> libscws.so.1.1.0
-rwxr-xr-x 1 root root 136894 Dec 21  2016 libscws.so.1.1.0
试试执⾏ scws⽂件
#/opt/app/scws/bin/scws -h
scws (scws-cli/1.2.3)
Simple Chinese Word Segmentation - Command line usage.
Copyright (C)2007 by hightman.
3、开始为php安装scws扩展
#cd scws-1.2.3/phpext/      #⼀定要先切换到这个表,否则执⾏失败
#/opt/app/php7/bin/phpize
Configuring for:
PHP Api Version:        20151012
Zend Module Api No:      20151012
Zend Extension Api No:  320151012
#./configure --with-php-config=/opt/app/php7/bin/php-config --with-scws=/opt/app/scws
为php7添加scws扩展
#make
#make install
Installing shared extensions:    /opt/app/php7/lib/php/extensions/no-debug-non-zts-20151012/会告知模块安装的路径
4、在php7的配置⽂件php.ini中添加scws扩展模块
#cd /opt/app/php7/etc
#vim php.ini
…………
extension_dir = "/opt/app/php7/lib/php/extensions/no-debug-non-zts-20151012"  #添加路径[redis]
extension = redis.so
extension = mongodb.so
extension = apcu.so
;extension = octopus.so
;octopus.disable_eval = On
##添加如下模块###
[scws]
extension = scws.so
scws.default.charset = gbk
scws.default.fpath = /opt/app/scws/etc
然后重启php7使其加载该模块
#kill -usr2 `cat /opt/app/php7/var/run/php-fpm.pid`  #重启php7
⼆、php5和php7配置⽂件php5
#cat f
[global]
pid = run/php-fpm.pid
error_log = log/php-fpm.log
[www]
user = httpd
group = httpd
listen = 127.0.0.1:9000
pm = dynamic
pm.max_children = 1000
pm.start_servers = 32
pm.min_spare_servers = 32
pm.max_spare_servers = 64
pm.max_requests = 5000
rlimit_files = 65535
>>>>>###
#cat etc/php.ini
[PHP]
engine = On
short_open_tag = On
asp_tags = Off
precision = 14
y2k_compliance = On
output_buffering = 4096
zlib.output_compression = Off
implicit_flush = Off
unserialize_callback_func =
serialize_precision = 100
allow_call_time_pass_reference = Off
safe_mode = On
safe_mode_gid = Off
safe_mode_include_dir =
safe_mode_exec_dir = /opt/case/phpinc
safe_mode_allowed_env_vars = PHP_
safe_mode_protected_env_vars = LD_LIBRARY_PATH
disable_functions = "exec,passthru,system,shell_exec,proc_open,proc_close,proc_get_status,proc_nice,proc_terminate,popen,p
disable_classes =
expose_php = Off
max_execution_time = 60
max_input_time = 60
memory_limit = 256M
error_reporting = E_ALL & ~E_DEPRECATED & ~E_NOTICE
display_errors = Off
display_startup_errors = Off
log_errors = On
;error_log = "/opt/logs/log"
log_errors_max_len = 1024
ignore_repeated_errors = Off
ignore_repeated_source = Off
report_memleaks = On
track_errors = Off
html_errors = Off
variables_order = "GPCS"
request_order = "GP"
register_globals = Off
register_long_arrays = Off
register_argc_argv = Off
auto_globals_jit = On
post_max_size = 200M
magic_quotes_gpc = Off
magic_quotes_runtime = Off
magic_quotes_sybase = Off
auto_prepend_file =
auto_append_file =
default_mimetype = "text/html"
include_path = ".:/opt/case/phpinc"
doc_root =
user_dir =
enable_dl = Off
file_uploads = On
upload_max_filesize = 200M
max_file_uploads = 20
allow_url_fopen = On
allow_url_include = Off
default_socket_timeout = 60
extension_dir = "/opt/app/php5/lib/php/extensions/no-debug-non-zts-20090626" [redis]
extension = redis.so
extension = mongo.so
;
extension = octopus.so
;octopus.disable_eval = On
[scws]
extension = scws.so
scws.default.charset = gbk
scws.default.fpath = /opt/app/scws/etc [Date]
date.timezone = "Asia/Shanghai" [filter]
[iconv]
[intl]
[sqlite]
[sqlite3]
[Pcre]
[Pdo]
[Pdo_mysql]
pdo_mysql.cache_size = 2000
pdo_mysql.default_socket=
[Phar]
[Syslog]
define_syslog_variables  = Off
[mail function]
SMTP = localhost
smtp_port = 25
mail.add_x_header = On
[SQL]
sql.safe_mode = Off
[ODBC]
odbc.allow_persistent = On
odbc.check_persistent = On
php8兼容php7吗odbc.max_persistent = -1
odbc.max_links = -1
odbc.defaultlrl = 4096
odbc.defaultbinmode = 1
[Interbase]

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。

发表评论