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
最新评论
大哥资深网民啊,01年我还在念小学。。
看着有点难过。。。
嘿嘿,谢谢老哥,也祝老哥事业蒸蒸日上。
我是你唯一的药学类友情链接网站。 作为一个80后的过来人祝福你,生活越来越好。
这篇文章,我们中学那会老师课堂上念给我们听的。
哈哈哈哈哈,没想到啊, 我有手抄版
嗯,是的
好心办坏事多了去啦
哈哈,是的,我15年末来上海写代码了,一晃三年多过去了,好快。
今天看QQ好友的时候突然看到了你的名字,想起几年前在药品国际注册群挺活跃/厉害的你,现在不见踪影了。就搜了一下,没想到你现在转行去写代码了... (刚才打漏了一句话...)