温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

ubuntu lamp环境如何搭建

发布时间:2022-10-12 11:45:45 来源:亿速云 阅读:122 作者:iii 栏目:系统运维

这篇“ubuntu lamp环境如何搭建”文章的知识点大部分人都不太理解,所以小编给大家总结了以下内容,内容详细,步骤清晰,具有一定的借鉴价值,希望大家阅读完这篇文章能有所收获,下面我们一起来看看这篇“ubuntu lamp环境如何搭建”文章吧。

一、环境安装
1.安装apache2
sudo apt-get install apache2
安装后在浏览器中打开:http://localhost/或者http://127.0.0.1
如果出现it works!证明apache安装成功。
2.安装php
sudo apt-get install php5
sudo apt-get install libapache2-mod-php5
sudo /etc/init.d/apache2 restart
测试:
sudo vi /var/www/testphp.php
写入php works!保存退出vi。
然后在浏览器中输入http://127.0.0.1/testphp.php或者http://localhost/testphp.php
如果显示出php works!表示php配置成功。
3.安装mysql
sudo apt-get install mysql-server
安装过程中按提示设置root密码即可。
注:修改密码:
mysql -uroot -p
mysql>use mysql;
mysql>update user set password=password('new password') where user='root';
mysql>exit
重启mysql,或是刷新权限也行
重启即可: sudo /etc/init.d/mysql restart 或是 restart mysql
4、让apache、php支持mysql
sudo apt-get install libapache2-mod-auth-mysql
sudo apt-get install php5-mysql
sudo /etc/init.d/apache2 restart
至此ubuntu+apache2+php 5+mysql的安装完成。
提示:
/etc/apache2/下:
1、apache2.conf 是主配置文件,httpd.conf 用户配置文件
2、虚拟目录在 httpd.conf 中
documentroot “路径”
servername 名称
#listen 127.0.0.1:80 #注意这个文件中不能写上监听,如果必须要写,那就需要先去apache2.conf下将include /etc/apache2/ports.conf 给注释掉,因为ports.conf中已经监听来80端口
3、目录设置在 /etc/apache2/sites-enabled/000-default 可以设置虚拟主机
4、php.ini: /etc/php5/apache2/php.ini
5、mysql.cnf: /etc/mysql/my.cnf
4、重启apache : /etc/init.d/apache2 restart
5、重启mysql: sudo /etc/init.d/mysql restart 或是 restart mysql
6、日志文件: /var/log/apache2/
二、gd库安装
sudo apt-get install php5-gd
sudo /etc/init.d/apache2 restart
三、curl扩展安装
sudo apt-get install php5-curl
sudo /etc/init.d/apache2 restart

以上就是关于“ubuntu lamp环境如何搭建”这篇文章的内容,相信大家都有了一定的了解,希望小编分享的内容对大家有帮助,若想了解更多相关的知识内容,请关注亿速云行业资讯频道。

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI