centos7下搭建php环境

2018-08-26  本文已影响0人  雪_豹
firewall
firewall-cmd --list-all
firewall-cmd --permanent --add-port=80/tcp
systemctl start firewalld
Apache
yum install -y httpd
systemctl start httpd
http://192.168.1.104/
mariadb(MySQL的替代品)
yum install -y mariadb mariadb-server
systemctl start mariadb
mysql -u root -p
php
yum install -y php
yum install -y php-mysql php-gd libjpeg* php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-bcmath php-mhash
Apache配置

Options Indexes FollowSymLinks修改为:Options Includes ExecCGI FollowSymLinks(允许服务器执行CGI及SSI,禁止列出目录)

DirectoryIndex index.html 修改为:DirectoryIndex index.html index.htm Default.html Default.htm index.php(设置默认首页文件,增加index.php

测试

vim /var/www/html/index.php

写入:<?php phpinfo(); ?>保存:wq!

http://192.168.1.104/index.php

上一篇 下一篇

猜你喜欢

热点阅读