Ubuntu下(Linux+Apache+MYSQL+PHP, LAMP)环境搭建
时间:2022-03-13 23:20
<span style="font-size: 18px;">sudo apt-get update</span> 第二步 安装Apache2
<span style="font-size: 18px;">sudo apt-get install apache2</span> 安装之后测试:在浏览器中打开 http://localhost/或者http://127.0.0.1
<span style="font-size: 18px;">sudo apt-get install mysql-server</span> 安装过程中需要设置root密码
<span style="font-size: 18px;">sudo apt-get install mysql-client</span> 第三步 安装PHP
<span style="font-size: 18px;">sudo apt-get install php5</span> 第四步 其他模块安装
<span style="font-size: 18px;">sudo apt-get install libapache2-mod-php5</span> 让apache、php支持mysql
<span style="font-size: 18px;">sudo apt-get install libapache2-mod-auth-mysql</span>
<span style="font-size: 18px;">sudo apt-get install php5-mysql</span>
<span style="font-size: 18px;">sudo /etc/init.d/apache2 restart</span>GD库安装:图库,如生成验证码,处理图片都离不开它
<span style="font-size: 18px;">sudo apt-get install php5-gd</span> curl扩展安装:支持ftp,http等等协议。用起来很方便
<span style="font-size: 18px;">sudo apt-get install php5-curl </span>
由于LAMP大部分操作与/var/www目录相关,为了方便,修改该目录的权限为普通用户可访问。
<span style="font-size: 18px;">sudo /etc/init.d/apache2 restart</span>第五步 修改权限
由于LAMP大部分操作与/var/www目录相关,为了方便,修改该目录的权限为普通用户可访问。
<span style="font-size: 18px;">sudo chmod 777 /var/www/</span> 第六步 安装phpmyadmin
<span style="font-size: 18px;">sudo apt-get install phpmyadmin</span> 安装过程中选择apache2
第七步 将phpmyadmin与apache2建立连接
第七步 将phpmyadmin与apache2建立连接
<span style="font-size: 18px;">sudo ln -s /usr/share/phpmyadmin /var/www</span> 测试:直接运行http://localhost/phpmyadmin,看有没有数据库管理软件出现
<span style="font-size: 18px;">sudo touch test.php</span> 并在文件中写入:
<span style="font-size: 18px;"><? php
phpinfo();
?></span> 保存此文件。
第九步 测试PHP
在浏览器中输入http://localhost/test.php,可以看到PHP的系统信息。
以上就完成了ubuntu下的LAMP开发环境配置。
以上就完成了ubuntu下的LAMP开发环境配置。
Ubuntu下(Linux+Apache+MYSQL+PHP, LAMP)环境搭建,布布扣,bubuko.com