立诚勿怠,格物致知
It's all about connecting the dots

CentOS7安装LAMP环境

LAMP is short for Linux, Apache, MySQL, PHP. Of course, you already have a Linux OS (CentOS), so  this article mainly introduces installation of Apache, MySQL and PHP. I need this environment because I use WordPress program which should run on basis of this environment.

Install Apache
# update software
yum update

# install Apache
yum install httpd

# start Apache
systemctl start httpd.service

# set apache to start on server boot
systemctl enable httpd.service

To verify the installation of Apache, open “http://your server’s IP address”, and if Apache was successfully installed, you should see an Apache Text Page.

Install MySQL
# install MariaDB, which is a community-developed fork of MySQL:
yum install mariadb-server mariadb

# start the service
systemctl start mariadb

# set MySQL to start on server boot
systemctl enable mariadb.service

# run this command to finish setting up the installation
mysql_secure_installation

You will be asked for the root password, because you didn’t set it earlier. Press Enter to set a password now.

Set root password and confirm the new password (this password is the password for your MySQL root account).

You will then be asked a series of questions as part of the security configuration. It’s a best practice to respond “Y” to these system prompts.

Install PHP
# install PHP
yum install php php-mysql

# restart Apache
systemctl restart httpd.service

Install PHP modules

If your applications requires any PHP modules, you can install them now.

# view available PHP modules
yum search php-

# to view the description of a specific package, use the following command:
yum info "the name of the package you want to use"(quotes not required)

# install the package you desire
yum install "the name of the package you desire"(quotes not required)

Test PHP processing on Apache

Firstly, create a new PHP file under the /var/www/html directory:

vi /var/www/html/info.php

Then, type in the following code to info.php:

<?php
phpinfo();
?>

Then, save and close the file:

:wq!

Lastly, open the url in your browser: “http://your server’s IP address/info.php”. You should see a page displaying information such as the PHP version, extensions, build date and etc., if PHP is successfully installed.

Reference:
  • Build a LAMP stack (Linux, Apache, MySQL, PHP) – CentOS 7: https://hk.godaddy.com/help/build-a-lamp-stack-linux-apache-mysql-php-centos-7-17344
赞(0) 打赏
版权声明:非商业用途转载请注明文章链接,商业用途转载请联系邮箱获取授权。
文章名称:《CentOS7安装LAMP环境》
文章链接:https://www.orzzone.com/instal-lamp-centos7.html
商业联系:yakima.public@gmail.com
本站内容仅供个人学习交流,不做为任何投资、建议的参考依据,因此产生的问题需自行承担。

评论 抢沙发

大前端WordPress主题 更专业 更方便

支持快讯、专题、百度收录推送、人机验证、多级分类筛选器,适用于垂直站点、科技博客、个人站,扁平化设计、简洁白色、超多功能配置、会员中心、直达链接、文章图片弹窗、自动缩略图等...

去看看

觉得文章有用就打赏一下文章作者

非常感谢你的打赏,我们将继续给力提供更多优质内容!

支付宝扫一扫打赏

微信扫一扫打赏

登录

找回密码

注册