配置php服务
[[email protected]]cd/usr/local/src
[root@linuxprobesrc]tarzxvfyasm-1.2.0.tar.gz
[root@linuxprobesrc]cdyasm-1.2.0
[[email protected]]./configure
[[email protected]]make
[[email protected]]makeinstall
安装libmcrypt加密算法扩展库(解烂银圆压与编译过程已省略):
[[email protected]]cd/usr/local/src
[root@linuxprobesrc]tarzxvflibmcrypt-2.5.8.tar.gz
[root@linuxprobesrc]cdlibmcrypt-2.5.8
[[email protected]]./configure
[[email protected]]make
[[email protected]]makeinstall
安装libvpx视频编码器(解压与编译过程搏旦已省略):
[[email protected]]cd/usr/local/src
[root@linuxprobesrc]tarxjvflibvpx-v1.3.0.tar.bz2
[root@linuxprobesrc]cdlibvpx-v1.3.0
[[email protected]]./configure--prefix=/usr/local/libvpx--enable-shared--enable-vp9
[[email protected]]make
[[email protected]]makeinstall
安装Tiff标签图像文件格式(解压与编译过程已省略):
[[email protected]]cd/usr/local/src
[root@linuxprobesrc]tarzxvftiff-4.0.3.tar.gz
[root@linuxprobesrc]cdtiff-4.0.3
[[email protected]]./configure--prefix=/usr/local/tiff--enable-shared
[[email protected]]make
[[email protected]]makeinstall
安装libpng图片(png格式)函数库(解压与编译过程已省略):
[[email protected]]cd/usr/local/src
[root@linuxprobesrc]tarzxvflibpng-1.6.12.tar.gz
[root@linuxprobesrc]cdlibpng-1.6.12
[[email protected]]./configure--prefix=/usr/local/libpng--enable-shared
[[email protected]]make
[[email protected]]makeinstall
安装freetype字体引擎(解压与编译过程已省略):
[[email protected]]cd/usr/local/src
[root@linuxprobesrc]tarzxvffreetype-2.5.3.tar.gz
[root@linuxprobesrc]cdfreetype-2.5.3
[[email protected]]./configure--prefix=/usr/local/freetype--enable-shared
[[email protected]]make
[[email protected]]makeinstall
安装jpeg图片(jpeg格式)函数库(解压与编译过程已省略):
[[email protected]]cd/usr/local/src
[root@linuxprobesrc]tarzxvfjpegsrc.v9a.tar.gz
[root@linuxprobesrc]cdjpeg-9a
[root@linuxprobejpeg-9a]./configure--prefix=/usr/local/jpeg--enable-shared
[root@linuxprobejpeg-9a]make
[root@linuxprobejpeg-9a]makeinstall
安装libgd图像处理程序(解压与编译过程已省略):
[root@linuxprobejpeg-9a]cd/usr/local/src
[root@linuxprobesrc]tarzxvflibgd-2.1.0.tar.gz
[root@linuxprobesrc]cdlibgd-2.1.0
[[email protected]]./configure--prefix=/usr/local/libgd--enable-shared--with-jpeg=/usr/local/jpeg--with-png=/usr/local/libpng--with-freetype=/usr/local/freetype--with-fontconfig=/usr/local/freetype--with-xpm=/usr/--with-tiff=/usr/local/tiff--with-vpx=/usr/local/libvpx
[[email protected]]make
[[email protected]]makeinstall
安装t1lib图片生成函数库(解压与编译过程已省略):
[[email protected]]cd/usr/local/src
[root@linuxprobesrc]tarzxvft1lib-5.1.2.tar.gz
[root@linuxprobesrc]cdt1lib-5.1.2
[[email protected]]./configure--prefix=/usr/local/t1lib--enable-shared
[[email protected]]make
[[email protected]]makeinstall
将函数库文件放至合适的位置:
[[email protected]]cd/usr/local/src
[root@linuxprobesrc]ln-s/usr/lib64/libltdl.so/usr/lib/libltdl.so
[root@linuxprobesrc]cp-frp/usr/lib64/libXpm.so*/usr/lib/
安装php服务程序(命令比较长,请一定要复制完整!!!):
[root@linuxprobesrc]tar-zvxfphp-5.5.14.tar.gz
[root@linuxprobesrc]cdphp-5.5.14
[[email protected]]exportLD_LIBRARY_PATH=/usr/local/libgd/lib
[[email protected]]./configure--prefix=/usr/local/php--with-config-file-path=/usr/local/php/etc--with-mysql=/usr/local/mysql--with-mysqli=/usr/local/mysql/bin/mysql_config--with-mysql-sock=/tmp/mysql.sock--with-pdo-mysql=/usr/local/mysql--with-gd--with-png-dir=/usr/local/libpng--with-jpeg-dir=/usr/local/jpeg--with-freetype-dir=/usr/local/freetype--with-xpm-dir=/usr/--with-vpx-dir=/usr/local/libvpx/--with-zlib-dir=/usr/local/zlib--with-t1lib=/usr/local/t1lib--with-iconv--enable-libxml--enable-xml--enable-bcmath--enable-shmop--enable-sysvsem--enable-inline-optimization--enable-opcache--enable-mbregex--enable-fpm--enable-mbstring--enable-ftp--enable-gd-native-ttf--with-openssl--enable-pcntl--enable-sockets--with-xmlrpc--enable-zip--enable-soap--without-pear--with-gettext--enable-session--with-mcrypt--with-curl--enable-ctype
[[email protected]]make
[[email protected]]makeinstall
复制php服务程序的配置文件到安装目录:
[[email protected]]cpphp.ini-proction/usr/local/php/etc/php.ini
删除默认的php配置文件:
[[email protected]]rm-rf/etc/php.ini
创建php配置文件的软连接到/etc/目录中:
[[email protected]]cp/usr/local/php/etc/php-fpm.conf.default/usr/local/php/etc/php-fpm.conf
[[email protected]]ln-s/usr/local/php/etc/php-fpm.conf/etc/php-fpm.conf
[[email protected]]ln-s/usr/local/php/etc/php.ini/etc/php.ini
编辑php服务程序的配置文件:
[[email protected]]vim/usr/local/php/etc/php-fpm.conf
//将第25行参数前面的分号去掉。
pid=run/php-fpm.pid
//修改第148和149行,将user与group修改为www。
user=www
group=www
添加php-fpm服务程序到开机启动项:
[[email protected]]cpsapi/fpm/init.d.php-fpm/etc/rc.d/init.d/php-fpm
[[email protected]]chmod+x/etc/rc.d/init.d/php-fpm
[[email protected]]chkconfigphp-fpmon
为了保障网站的安全性,禁用掉不安全的功能:
[[email protected]]vim/usr/local/php/etc/php.ini
//修改第305行的disable_functions参数,追加参数为:
disable_functions=passthru,exec,system,chroot,scandir,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,escapeshellcmd,dll,popen,disk_free_space,checkdnsrr,checkdnsrr,getservbyname,getservbyport,disk_total_space,posix_ctermid,posix_get_last_error,posix_getcwd,posix_getegid,posix_geteuid,posix_getgid,posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid,posix_getppid,posix_getpwnam,posix_getpwuid,posix_getrlimit,posix_getsid,posix_getuid,posix_isatty,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_strerror,posix_times,posix_ttyname,posix_uname
配置nginx服务程序支持php:
[[email protected]]vim/usr/local/nginx/conf/nginx.conf
//将第2行前面的号去掉并修改为userwwwwww;
//将第45行参数修改为indexindex.htmlindex.htmindex.php;
//将第65-71行前面的号去掉,修改为:
location~.php${
roothtml;
fastcgi_pass127.0.0.1:9000;
fastcgi_indexindex.php;
fastcgi_paramSCRIPT_FILENAME$document_root$fastcgi_script_name;
includefastcgi_params;
}
重启nginx与php-fpm服务程序:
[[email protected]]systemctlrestartnginx
[[email protected]]systemctlrestartphp-fpm
❷ linux yum安装php7.3
先安装前面的教程,再安装后面的
参考教程1:
https://blog.csdn.net/weixin_43731793/article/details/91488289
参考教程2:
http://www.bubuko.com/infodetail-2931909.html
安装PHP
1、安装PHP73
1.1、卸载旧版本PHP
yum remove php*
1.2、安装EPEL:
sudo yum install epel-release
1.3、安装remi(选一个):
sudo rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
1.4、查看目前有php的什么版本(可忽略)
sudo yum list php*
1.5、列出所有的php相关的rpm包(可忽略)
rpm -qa|grep php
1.6、删除php相关的rpm包(一次只能删除一个)(可忽略)
rpm -e php72w-mysqlnd-7.2.17-1.w7.x86_64
1.7、列出remi仓库下所有PHP7.3可用模块。(可忽略)
yum --enablerepo=remi-php73 search php | grep php73
1.8、安装PHP 7.3
yum --enablerepo=remi-php73 install php
1、安装 PHP7.3:
(解决yum安装apache关联不了PHP的问题,用以下命令安装)
yum --enablerepo=remi-php73 install php
安装模块
yum --enablerepo=remi-php73 install php73-php-fpm php73-php-cli php73-php-bcmath php73-php-gd php73-php-json php73-php-mbstring php73-php-mcrypt php73-php-mysqlnd php73-php-opcache php73-php-pdo php73-php-pecl-crypto php73-php-pecl-mcrypt php73-php-pecl-geoip php73-php-recode php73-php-snmp php73-php-soap php73-php-xml
2、设置开机启动、运行服务:
systemctl enable php73-php-fpm
systemctl start php73-php-fpm
3、查找php.ini位置:
find /etc/opt/remi/php73 -name php.ini
/etc/opt/remi/php73/php.ini
找到apache的配置文件:httpd.conf
sudo find / -name httpd.conf
位置如下:
/etc/httpd/conf/httpd.conf
5、PHP日常操作
systemctl restart php73-php-fpm #重启
systemctl start php73-php-fpm #启动
systemctl stop php73-php-fpm #关闭
systemctl status php73-php-fpm #检查状态
php -m #查看PHP已安装拓展模块
php -v #查看PHP版本
❸ 如何查看linux上有没有安装phpadmin
可以用find命令查找 比如安装的是mysql,就是用 find -name mysql 如果想知道装没装postgresql,那就用find查postgresql
❹ 如何检查linux是否安装了php
1、首先可以利用find / -name php.ini 查找一下,系统是否有php的配置文件
2、利用netstat -ntpl 查看9000端口是否在运行
3、如果9000端口存在,可以使用lsof -i:9000查看文件位置
4、另外,如果系统已经安装了php,你还可以用php -v 查看版本号,前提是设置环境变量