rebuild:
make clean
vi Makefile
Add ‘-I/usr/include/freetype2‘ to INCLUDE
Add ‘-lfreetype‘ to GD_SHARED_LIBADD
execute command:
make
make install
This Domain is for sale.
rebuild:
make clean
vi Makefile
Add ‘-I/usr/include/freetype2‘ to INCLUDE
Add ‘-lfreetype‘ to GD_SHARED_LIBADD
execute command:
make
make install
sudo yum install libc-client
sudo yum install libc-client-devel
./configure –with-kerberos –with-imap-ssl
Add simplexml to php.
When I input command ‘php -m’, output ‘Invalid library (maybe not a PHP library)’.
Afer I re-make ext/simplexml, probem still appear.
A few minutes, I find php/modules contain simplexml.so, however make install create other path.
I re-make again:
pipize –clean
pipize
./configure –with-php-config=/usr/local/php/bin/php-config
make
make install
php -m, that is ok
当在命令行运行PHP的CLI版本时,您可能会收到类似以下错误:
[root@myserver /root]$ php -v PHP Warning: Module 'pcre' already loaded in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/php5/lib/php/extensions/no-debug-non-zts-20060613/spl.so' - /usr/local/php5/lib/php/extensions/no-debug-non-zts-20060613/spl.so: Undefined symbol "pcre_exec" in Unknown on line 0 PHP Warning: Module 'SimpleXML' already loaded in Unknown on line 0 PHP Warning: Module 'session' already loaded in Unknown on line 0 PHP Warning: Module 'exif' already loaded in Unknown on line 0 PHP 5.2.3 (cli) (built: Jun 14 2007 15:29:17) Copyright (c) 1997-2007 The PHP Group Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
在PHP中对于大多数扩展而言加载有两种方法。一种是直接编译扩展到PHP二进制文件。另一种是通过一个ini文件动态加载的共享扩展。这些错误表明,动态扩展正在通过.ini文件加载,即使它们已经被编译到PHP二进制文件中。
要解决此问题,您必须编辑你的php.ini(或extensions.ini文件)文件并注释掉那些已经编译的扩展。例如,修改完成后,你的ini文件修改完可能看起来像下面这几行:
;extension=pcre.so
;extension=spl.so
;extension=simplexml.so
;extension=session.so
;extension=exif.so
当然你也可以删除这些行,而不是注释掉。一但你注释或删除掉这些行,再运行php -v 警告消失。
要了解哪些扩展已经编译到你的PHP中,运行以下命令:
php -m
您还可以查看configure命令,它会显示通过编译、建成共享或动态模块启动的扩展。
php -i | grep Configure
动态扩展通常位于一个特殊的“extensions”的文件夹中,其会根据操作系统环境而变化。你的php.ini通常有一行会显示这个说明文件夹。例如:
Directory in which the loadable extensions (modules) reside.
extension_dir = "/usr/local/php5/lib/php/extensions/no-debug-non-zts-20060613/"
原文连接http://www.somacon.com/p520.php
check php.ini file.
set short_open_tag = On
From: https://www.jianshu.com/p/04e8ad506ad7
更新软件到最新
yum update
下载php源码并解压
wget https://www.php.net/distributions/php-8.0.0.tar.gz
tar-xvzf php-8.0.0.tar.gz
cd php-8.0.0
安装gcc软件
yum install gcc gcc-c++ make
安装php依赖软件
yum install libxml2 libxml2-devel openssl openssl-devel freetype freetype-devel libzip libzip-devel sqlite sqlite-devel gd gd-devel libcurl-devel libicu libicu-devel libxslt libxslt-devel
安装oniguruma软件
yum install https://rpms.remirepo.net/enterprise/8/remi/x86_64/oniguruma5php-6.9.8-1.el8.remi.x86_64.rpm
yum install https://rpms.remirepo.net/enterprise/8/remi/x86_64/oniguruma5php-devel-6.9.8-1.el8.remi.x86_64.rpm
配置编译
./configure –prefix=/usr/local/php –with-zlib-dir –enable-mbstring –enable-soap –enable-calendar –with-curl –disable-rpath –enable-gd –enable-gd-jis-conv –with-bz2 –with-zlib –enable-sockets –enable-sysvsem –enable-sysvshm –enable-pcntl –enable-mbregex –enable-exif –enable-bcmath –with-mhash –with-pdo-mysql –with-mysqli –with-openssl –with-fpm-user=www –with-fpm-group=www –with-libdir=/lib/x86_64-linux-gnu/ –enable-ftp –with-gettext –with-xsl –enable-opcache –enable-fpm –with-iconv –with-zip –with-pear –with-freetype –enable-intl
开始编译
make -j4 #指定同时运行的作业数量,让尽可能多的作业同时运行。如果有一个以上的“-j”选项,最后一个选项是有效的。
安装php
make install
添加php.ini配置文件
cp php.ini-production /usr/local/php/lib/php.ini
以下操作为配置php
添加用户
useradd www
修改php-fpm.conf
cd /usr/local/php/etc
cp php-fpm.conf.default php-fpm.conf
cd php-fpm.d
cp www.conf.default www.conf
编辑www.conf文件,根据自己的服务器配置修改以下配置
pm.max_children=10
pm.start_servers=5
pm.min_spare_servers=4
pm.max_spare_servers=7
移除前面的注释;
;env[HOSTNAME] = $HOSTNAME
;env[PATH] = /usr/local/bin:/usr/bin:/bin
;env[TMP] = /tmp
;env[TMPDIR] = /tmp
;env[TEMP] = /tmp
修改php配置文件
cd /usr/local/php/lib
vim php.ini
修改内存限制
memory_limit=512M
修改上传文件限制
post_max_size=512M
upload_max_filesize=512M
启用OPcache 和 JIT; OPcache [1] 通过将 PHP 脚本预编译的字节码存储到共享内存中来提升 PHP 的性能, 存储预编译字节码的好处就是 省去了每次加载和解析 PHP 脚本的开销。
移除注释
;zend_extension=opcache
[opcache]
opcache.enable=1
opcache.memory_consumption=128
;opcache.interned_strings_buffer=8
;opcache.max_accelerated_files=10000
;opcache.validate_timestamps=1
在[opcache]添加jit支持
opcache.jit_buffer_size=128M
注意:虚拟机里可能启动时报错。
设置php-fpm开机启动
vim /usr/lib/systemd/system/php-fpm.service
其内容为
[Unit]
Description=The PHP FastCGI Process ManagerAfter=network.target
[Service]
Type=simple
PIDFile=/usr/local/php/var/run/php-fpm.pid
ExecStart=/usr/local/php/sbin/php-fpm –nodaemonize –fpm-config /usr/local/php/etc/php-fpm.conf
ExecReload=/bin/kill -USR2 $MAINPID
PrivateTmp=true
[Install]
WantedBy=multi-user.target
保存退出后执行
systemctl enable php-fpm
systemctl start php-fpm
查看运行状态
systemctl status php-fpm
Linux命令行
ln -s /usr/local/php/bin/php /usr/bin/php
安装libphp.so
sudo yum install http://mirror.centos.org/centos/8-stream/AppStream/x86_64/os/Packages/php-common-8.0.20-1.module_el8.7.0+1191+c110972c.x86_64.rpm
sudo yum install http://mirror.centos.org/centos/8-stream/AppStream/x86_64/os/Packages/php-embedded-8.0.20-1.module_el8.7.0+1191+c110972c.x86_64.rpm
接着安装和配置httpd