Linux下搭建LAMP环境YUM

php中文网
发布: 2016-07-29 09:10:03
原创
1151人浏览过

整理一下最近学习搭建lamp的心得

  • VMware版本号:11.1.2

  • CentOS版本:6.6

安装<strong>Apache</strong>

1.安装<strong>Apache</strong>

<code> yum -y install httpd</code>
登录后复制

2. <strong>Apache</strong>配置httpd.conf

  • 通过命令 find / -name httpd.conf 找到<strong>Apache</strong>配置文件httpd.conf(默认在/etc/httpd/conf/httpd.conf)

  • 编辑httpd.conf文件

    <code>  vi /etc/httpd/conf/httpd.conf</code>
    登录后复制

    修改DocumentRoot "/xx/xx/xxx",项目在哪个目录下,就将"/xx/xx/xxx"改为哪个目录,例如DocumentRoot "/var/www/html" ,同样将<directory></directory>修改为<directory></directory>

  • 查看是否安装成功(启动<strong>Apache</strong>,并查看<strong>Apache</strong>状态)

    <code>  service httpd start
      service httpd status</code>
    登录后复制

显示OK说明安装成功

  • 配置<strong>Apache</strong>开机启动项

    <code>   chkconfig --add httpd (在服务清单中添加httpd服务)
       chkconfig httpd on
       </code>
    登录后复制

安装Mysql

1. 安装Mysql

<code>yum -y install mysql mysql-devel mysql-server mysql-libs</code>
登录后复制

2. 查看Mysql版本

AI建筑知识问答
AI建筑知识问答

用人工智能ChatGPT帮你解答所有建筑问题

AI建筑知识问答 22
查看详情 AI建筑知识问答
<code>rpm -qi mysql-server</code>
登录后复制

3. 数据库字符集设置

  • Mysql配置文件/etc/my.cnf中加入default-character-set=utf8

4. 启动Mysql

<code>service mysqld start</code>
登录后复制

5. 创建root管理员

<code>mysqladmin -u root password 密码</code>
登录后复制

6. 配置Mysql开机启动服务

<code> chkconfig --add mysqld  (在服务清单中添加mysql服务)
 chkconfig mysqld on     (设置mysql服务随开机启动) </code>
登录后复制

7. 登录Mysql

<code>mysql -u root -p 回车输入密码</code>
登录后复制

安装PHP

1. 安装PHP

<code>yum -y install php
</code>
登录后复制

2. 安装PHP扩展

<code>yum -y install php-mysql php-gd php-imap php-ldap php-odbc php-mbstring php-devel php-soap php-cli php-pdo    

yum -y install php-mcrypt php-tidy php-xml php-xmlrpc php-pear

yum -y install php-pecl-memcache php-eaccelerator</code>
登录后复制

3. 重启<strong>Apache</strong>

<code>service httpd restart</code>
登录后复制

4. 测试

  • /var/www/html/下创建index.php文件,并写入phpinfo()

  • 浏览器访问index.php文件,如果输出phpinfo信息,安装成功

以上就介绍了Linux下搭建LAMP环境YUM,包括了Apache,安装Apache方面的内容,希望对PHP教程有兴趣的朋友有所帮助。

相关标签:
最佳 Windows 性能的顶级免费优化软件
最佳 Windows 性能的顶级免费优化软件

每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。

下载
来源:php中文网
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
最新问题
开源免费商场系统广告
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号