php安装(纯文本,无图片)
前言:本次内容接上次的Apache环境做
1.安装yum源
yum -y install libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel curl curl-devel openssl openssl-devel
2.执行
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/httpd/bin/apxs --with-mysql-sock=/usr/local/mysql/mysql.sock --with-mysqli --with-zilb --with-curl --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-openssl --enable-mbstring --enable-xml --enable-session --enable-pdo --enable-tokenizer --enable-zip
3.编译和安装
make && make install
3.1CP一下内容到指定路径
cp php.ini- development /usr/local/php/ib/php.ini
添加mysql的连接方式
4.先进入这个路径
vi /usr/local/php/lib/php.ini
在mysqli.default_socket = (后面加,要有空格)/usr/local/mysql/mysql.sock
在date.timezone = (后面加,要加上空格)Asia/Shanghai
验证一下模板
/usr/local/php/bin/php -m
在vi /etc/httpd.conf中新增(设置网页的类型)
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz(在这个后面新增)
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
在DirectoryIndex后面加index.php(作用是是它先访问php)
<IfModule dir_module
DirectoryIndex index.php index.html
5.自己编辑一个php脚本
vi index.php
<?php phpinfo(); ?>6.重启httpd服务
systemctl restart httpd
6.1动态访问
http://192.168.5.120/
访问效果图如下:
6.2静态访问
要在后面加具体地址:http://192.168.5.120/limo.html