1.yum安装apache mysql php
[root@www ~]# yum install httpd mysql mysql-server php php-mysql
2.启动apache
service httpd start
3. 访问测试
/var/www/html
vim index.php
<?php
phpinfo();
?>
浏览器中输入ip即可访问
如果你是问linux自动安装的Apache的话,直接使用apachectl-v命令,如果告诉你没有这个方法就可以知道系统没有安装Apache,如果已经安装了则显示Apache的版本,至于安装目录,使用apachectl -c就可以知道了。
使用Apachectl的前提条件也得你知道Apache源码安装的全路径啊,一般是 /usr/local/Apache2/bin/apachectl(我电脑上的路径是/usr/sbin/apachectl)。如通是通过rpm包安装的话直接rpm -q httpd 就能看有没有安装了
启动apache
[root@localhost ~]# service httpd start
重启apache
[root@localhost ~]# service httpd restart
如果出现错误:
Could not reliably determine the server’s fully qualified domain name, using localhost.locallm for ServerName
那么(centos)打开apache配置文件 cd /etc/httpd/conf/
vi httpd.conf
最后加上以下这句
ServerName localhost.locallm