
默许情况下,apache装置完成以后是没有办法直接剖析PHP页面的,我们须要修正一下设置文件
1、启动httpd效劳 (引荐进修:PHP视频教程)
/usr/local/apache2.4/bin/apachectl start
2、默许没有修正设置文件的情况下,刚启动httpd的时刻会报一个没有定义ServerName的提醒,但并不影响httpd的一般启动
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain. Set the 'ServerName' directive globally to suppress this message
3、修正设置文件
cp /usr/local/apache2.4/conf/httpd.conf /usr/local/apache2.4/conf/httpd.conf.bak //修正任何设置文件,先拷贝一份副本 vim /usr/local/apache2.4/conf/httpd.conf +195 ServerName www.example.com:80 //在恣意处新增一段ServerName
默许情况下httpd只允许用户接见迎接页面目次下的文件,接见其他httpd目次都是403,这是因为httpd默许规则是denied,我们须要改成granted
vim /usr/local/apache2.4/conf/httpd.conf 把 <Directory /> AllowOverride none Require all deined </Directory> 改成: <Directory /> AllowOverride none Require all granted </Directory> 默许情况下httpd不支持剖析php页面,为了能让httpd与php连系,须要新增一些设置内容 AddType application/x-httpd-php .php 还须要增添一个目次索引 <IfModule dir_module> DirectoryIndex index.html index.php </IfModule> 以上修正完成以后保留退出
4、当我们修正完设置文件后,须要搜检一下是不是有语法毛病然后再举行重启等操纵
/usr/local/apache2.4/bin/apachectl -t//运用-t搜检语法,涌现Syntax OK 申明设置文件没有毛病
5、让httpd设置文件见效有两种要领
1)/usr/local/apache2.4/bin/apachectl restart//重启启动httpd效劳 2)/usr/local/apache2.4/bin/apachectl graceful //只从新加载设置文件,不重启httpd效劳
6、编写一个php测试剧本,检测httpd是不是可以剖析php页面(默许页面寄存途径是在/usr/local/apache2.4/htdocs目次下)
vim /usr/local/apache2.4/htdocs/test.php <?php phpinfo(); ?>
7、浏览器输入本身效劳器的IP地点+php页面称号,涌现以下页面申明httpd剖析php页面一般
以上就是apache怎样剖析php页面的细致内容,更多请关注ki4网别的相干文章!