标签: PHP

CentOS Stream 9安装PHP8.2

安装remi源

dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm
dnf install https://rpms.remirepo.net/enterprise/remi-release-9.rpm

查看可以安装的PHP版本

dnf module list php
Remi's Modular repository for Enterprise Linux 9 - x86_64
Name      Stream        Profiles                        Summary
php       remi-7.4      common [d], devel, minimal      PHP scripting language
php       remi-8.0      common [d], devel, minimal      PHP scripting language
php       remi-8.1      common [d], devel, minimal      PHP scripting language
php       remi-8.2      common [d], devel, minimal      PHP scripting language

Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled

启用PHP8.2版本

dnf module enable php:remi-8.2

安装PHP扩展

dnf install php-fpm php php-bcmath php-cli php-common php-gd php-imap php-mbstring php-mcrypt php-mysql php-mysqlnd php-pdo php-soap php-tidy php-xml php-xmlrpc php-opcache php-redis php-pecl-mcrypt -y

查看PHP版本

php -v
PHP 8.2.2 (cli) (built: Jan 31 2023 13:31:55) (NTS gcc x86_64)
Copyright (c) The PHP Group
Zend Engine v4.2.2, Copyright (c) Zend Technologies
    with Zend OPcache v8.2.2, Copyright (c), by Zend Technologies

开启jit功能

cd /etc/php.d/

编辑扩展文件,在文件最后添加jit配置

vim 10-opcache.ini
opcache.jit_buffer_size=256M
opcache.jit=1255

重启PHP

systemctl restart php-fpm

查看jit是否开启成功

php -i|grep 'opcache.jit'
opcache.jit => 1255 => 1255
opcache.jit_bisect_limit => 0 => 0
opcache.jit_blacklist_root_trace => 16 => 16
opcache.jit_blacklist_side_trace => 8 => 8
opcache.jit_buffer_size => 256M => 256M
opcache.jit_debug => 0 => 0
opcache.jit_hot_func => 127 => 127
opcache.jit_hot_loop => 64 => 64
opcache.jit_hot_return => 8 => 8
opcache.jit_hot_side_exit => 8 => 8
opcache.jit_max_exit_counters => 8192 => 8192
opcache.jit_max_loop_unrolls => 8 => 8
opcache.jit_max_polymorphic_calls => 2 => 2
opcache.jit_max_recursive_calls => 2 => 2
opcache.jit_max_recursive_returns => 2 => 2
opcache.jit_max_root_traces => 1024 => 1024
opcache.jit_max_side_traces => 128 => 128
opcache.jit_prof_threshold => 0.005 => 0.005

设置PHP开机自启

systemctl enable php-fpm

转自:https://www.ggdoc.cn/archives/302

Centos6下yum最新php

安装EPEL源:

(64位系统) rpm -ivh http://download.fedora.redhat.com/pub/epel/6/x86_64/epel-release-6-5.noarch.rpm
(32位系统) rpm -ivh http://download.fedora.redhat.com/pub/epel/6/i386/epel-release-6-5.noarch.rpm
安装REMI源:
rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
开启REMI,编辑 /etc/yum.repos.d/remi.repo
修改 enable=1

 

php代码实现.Text密码加密方式

今日在转换.Text数据到php平台,需要用到用户密码的问题。
1234
.Text里是:0F-03-75-84-C9-9E-7F-D4-F4-F8-C5-95-50-F8-F5-07
php里md5是:81dc9bdb52d04dc20036dbd8313ed055
差的还够远的,.Text里面在md5前还Unicode一把。
注:我不得不承认M$在多字节编码中做的是在是好,从98以后开始,统一平台,应用程序都不存在编码问题,MSSQL用的一点问题都没,反看Php、MySQL编码问题都头大了。

网上都没有现成的代码,还是在php手册里看到一句话:

If you are trying to emulate the UnicodeEncoding.Unicode.GetBytes() function in .NET, the encoding you want to use is: UCS-2LE

URL:http://cn2.php.net/manual/en/ref.mbstring.php#70294
莫大的启发啊。php要支持:Multibyte String,mbstring哦。
.Text密码加密方式:

password = password.ToLower();
Byte[] clearBytes = new UnicodeEncoding().GetBytes(password);
Byte[] hashedBytes = ((HashAlgorithm)CryptoConfig.CreateFromName("MD5")).ComputeHash(clearBytes);

php代码实现:

strtoupper(substr(chunk_split(md5(mb_convert_encoding(strtolower($password), 'UCS-2LE')), 2, '-'), 0, -1));

PHP baidu mp3下载

简介:
支持 歌名+歌手 此方式下载,所以支持百度mp3(新歌TOP100、歌曲TOP500、经典老歌、热门对唱、相声小品荟萃、摇滚歌曲榜)下载。
Continue…

WordPress中文搜索插件

说明:
SCWS 是 Simple Chinese Words Segmentation 的缩写(简易中文分词系统)。它是一套基于词频词典的机械中文分词引擎,它能将一整段的汉字基本正确的切分成词,因为词是汉语的基本语素单位,而书写的时候不像英语会在词之间用空格分开,所以如何准确快速的分词一直是中文分词的攻关难点。本插件是基于 SCWS 而做。安装后请重建您的索引,否则无法搜索您原来的博客。
Continue…

SCWS-PHP扩展的说明及用法

详细请访问:http://www.hightman.cn

[SCWS 简介]

SCWS 是 Simple Chinese Words Segmentation 的缩写(简易中文分词系统)。它是一套基于词频词典的机械中文分词引擎,它能将一整段的汉字基本正确的切分成词,因为词是汉语的基本语素单位,而书写的时候不像英语会在词之间用空格分开,所以如何准确快速的分词一直是中文分词的攻关难点。

本分词法并无太多创新成分,采用的是自己采集的词频词典,并辅以一定的专有名称,人名,地名,数字年代等规则识别来达到基本分词,经小范围测试大概准确率在 90% ~ 95% 之间,已能基本满足一些小型搜索引擎、关键字提取等场合运用。首次雏形版本发布于 2005 年底。

本系统支持的汉字编码包括 GBK、UTF-8

Continue…

PHP SOAP Extension

[转]http://devzone.zend.com/node/view/id/689
PHP SOAP Manual: http://cn.php.net/manual/zh/ref.soap.php

Intended Audience
Introduction
A First SOAP Client
•  Example 1 (client1.php)
•  Example 2 (client2.php)
•  A First SOAP Server
•  Example 3 (stockquote.wsdl)
•  Example 4 (server1. php)
•  Example 5 (client3.php)
•  Example 6 (server2.php)
•  Example 7 (client4.php)
What’s inside?
•  Example 8 (client5.php)
Other Implementations of SOAP for PHP
Summary
References
About the Author
Revision Date

Continue…