安装运行Apache,Mysql,php

来源:互联网 发布:sja1000 接收数据 编辑:程序博客网 时间:2024/06/04 18:23

<span style="font-family: Arial, Helvetica, sans-serif;">Apache:</span>

安装:yum install httpd

运行:新版/usr/sbin/apachectl start

老版/etc/init.d/httpd start(老版Yum安装后会自动配置好开机启动项)

在找不到运行文件时,应当运行rpm -ql httpd,寻找安装位置。

停止:将start改为stop即可。

开机自启

systemctl enable httpd.service

启动Apache

systemctl start httpd.service

httpd是服务器的服务名,apache是服务器提供软件的名字。


Mysql:

安装:yum install mysql

    yum install mysql-server

    yum install mysql-devel(安装完上面两步可能不需要了)

运行:service mysqld start

    mysql -u root

开机自启:

systemctl enable mysqld.service

注意:如果收到这样的错误

Failed to issue method call: No such file or directory

使用下面的命令

systemctl enable mariadb.service

进一步启动mysql的服务

systemctl start mysqld.service

更改密码:

mysql -u root

mysql> use mysql;
mysql> UPDATE user SET Password = PASSWORD('newpass') WHERE user = 'root';
mysql> FLUSH PRIVILEGES;

php:

安装:yum install php

查看:重启httpd服务:systemctl restart httpd.service

建立探针文件info.php

<?php

phpinfo();

?>

访问localhost/info.php,可见php已正常运行。

使php与mysql合作:

yum install php-mysqlnd php-mssql php-opcache

重启Apache2:

systemctl restart httpd.service

更多:

http://www.linuxidc.com/Linux/2014-05/101266p2.htm


0 0
原创粉丝点击