Ubuntu下LAMP环境搭建 Apache、MySQL、PHP
由于刚学习Linux,选择了界面比较友好的Ubuntu进行研究。命令行+可视化对于初学者来说组合还是比较不错的,图形界面作为命令行的一个过渡能比较直观的看到效果。在应用中学习是一个比较好的办法,我就是为了搭建一个基于Linux的服务器环境而进行学习的,根据网上搜集的资料,完成了LAMP的配置。
主要过程如下:
1.LAMP的安装顺序问题,现在是默认安装好了Linux系统,我的版本是Ubuntu 12.04.一般来说比较建议的顺序是Mysql Apache 最后安装PHP,在我实践下来 Apache和Mysql顺序可以反过来,因为二者依赖性并不是很强,但PHP要安装在这两个后面,因为是要依赖Apache和Mysql的服务的。
2.MysSQL安装:打开命令行输入 :sudo apt-get install mysql-server 输入管理员密码 选择Y
在安装的中间会出现输入Mysql的管理员密码的提示,设置一下Mysql的密码:
安装完成后查看服务:输入 sudo netstat -tap | grep mysql 显示监听的端口即表示安装成功
3.安装Apache 在命令行输入 sudo apt-get install apache2 输入管理员密码 并选择Y
检查是否安装成功:打开本机的浏览器 输入 127.0.0.1 出现下图的界面即表示安装成功
4.安装PHP 输入 sudo apt-get install php5 libapache2-mod-php5
安装完成后测试下是否成功:
首先需要将www目录更改下所有权以便可以新建文档 输入 sudo chmod 777 /var/www
新建一个文档: sudo vi /var/www/info.php
按下i键编辑文件 输入
phpinfo();
?>
ESC 后输入:wq保存退出
重启下Apache:输入sudo /etc/init.d/apache2 restart .
在浏览器中输入 127.0.0.1/phpinfo.php,出现PHP的相关配置信息即表示成功
5.最后安装相关的PHP与Mysql的扩展包:
sudo apt-get install php5-mysql php5-curl php5-gd php5-intl php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-ming php5-ps php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl;
6.为了更方便的管理数据库 同时也建议安装phpmyadmin。命令行输入 sudo apt-get install phpmyadmin,中间会出现一次输入管理密码的提示,按照提示输入即可。
安装完成后需要将phpmyadmin的文件夹复制到www文件下进行管理:sudo cp /usr/share/phpmyadmin /var/www -a
然后打开浏览器输入http://127.0.0.1/phpmyadmin 出现如下页面后就表示已经成功
至此基本的环境搭建已经完成,如果有步骤出不来建议搜索一下,我整体安装下来还是比较顺利的。
最后可以看出来在Linux下安装环境真的比windows下方便很多不需要配置环境变量等兼容性等乱七八糟的东西,确实极大的提高了效率。
下面关于LAMP相关的内容你可能也喜欢:
LAMP平台安装Xcache和Memcached加速网站运行 http://www.linuxidc.com/Linux/2015-06/118835.htm
CentOS 7下搭建LAMP平台环境 http://www.linuxidc.com/Linux/2015-06/118818.htm
CentOS 6.5系统安装配置LAMP(Apache+PHP5+MySQL)服务器环境 http://www.linuxidc.com/Linux/2014-12/111030.htm
Ubuntu 14.04 配置 LAMP+phpMyAdmin PHP(5.5.9)开发环境 http://www.linuxidc.com/Linux/2014-10/107924.htm
Ubuntu 14.10 下安装 LAMP 服务图文详解 http://www.linuxidc.com/Linux/2014-12/110082.htm
LAMP结合NFS构建小型博客站点 http://www.linuxidc.com/Linux/2015-08/121029.htm
更多Ubuntu相关信息见 Ubuntu 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=2
本文永久更新链接地址: http://www.linuxidc.com/Linux/2016-01/127180.htm

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Alipay PHP...

JWT is an open standard based on JSON, used to securely transmit information between parties, mainly for identity authentication and information exchange. 1. JWT consists of three parts: Header, Payload and Signature. 2. The working principle of JWT includes three steps: generating JWT, verifying JWT and parsing Payload. 3. When using JWT for authentication in PHP, JWT can be generated and verified, and user role and permission information can be included in advanced usage. 4. Common errors include signature verification failure, token expiration, and payload oversized. Debugging skills include using debugging tools and logging. 5. Performance optimization and best practices include using appropriate signature algorithms, setting validity periods reasonably,

The application of SOLID principle in PHP development includes: 1. Single responsibility principle (SRP): Each class is responsible for only one function. 2. Open and close principle (OCP): Changes are achieved through extension rather than modification. 3. Lisch's Substitution Principle (LSP): Subclasses can replace base classes without affecting program accuracy. 4. Interface isolation principle (ISP): Use fine-grained interfaces to avoid dependencies and unused methods. 5. Dependency inversion principle (DIP): High and low-level modules rely on abstraction and are implemented through dependency injection.

How to automatically set the permissions of unixsocket after the system restarts. Every time the system restarts, we need to execute the following command to modify the permissions of unixsocket: sudo...

How to debug CLI mode in PHPStorm? When developing with PHPStorm, sometimes we need to debug PHP in command line interface (CLI) mode...

Article discusses late static binding (LSB) in PHP, introduced in PHP 5.3, allowing runtime resolution of static method calls for more flexible inheritance.Main issue: LSB vs. traditional polymorphism; LSB's practical applications and potential perfo

Sending JSON data using PHP's cURL library In PHP development, it is often necessary to interact with external APIs. One of the common ways is to use cURL library to send POST�...

Static binding (static::) implements late static binding (LSB) in PHP, allowing calling classes to be referenced in static contexts rather than defining classes. 1) The parsing process is performed at runtime, 2) Look up the call class in the inheritance relationship, 3) It may bring performance overhead.
