mysql作业纸_作业 01 - Homework - php中文网博客

On Deploy a PHP development environment

First of all, install Ubuntu 20.04 LTS.

For convenience, we will install fish in replace of the preinstalled default shell (In classical Ubuntu, it should be bash).

As a person without prior development experience, I find bash very hard to use since I cannot autocomplete, inter alia, file name and command, I installed fish for better dev experience.

Installation on Fish

sudo apt install fish

Then run chsh -s /usr/bin/fish which will change the default shell to fish shell we just installed.

Then we commence the actual process of environment buildup, i.e. installation of LAMP.

Installation on Apache

Like always, update the repository list using

sudo apt update

After prompted to enter user passwd, I can be exempted from entering passwd within this session.

Then, start to install Apache

sudo apt install apache2

After installation, I chose to disable ufw firewall for convenience.

Run sudo ufw disable. After that, the terminal should appear a line prompt you that the firewall has been disabled.

Then, we can start to test on whether our server has been started. First of all, start Apache by commanding

start apache2 in Windows Powershell or sudo service apache2 start.

After Apache being successfully started, open http://localhost/index.html to test if it works.

A page should be displayed with the title of

Apache2 Debian Default Page

If you can see that, congratulation! Your Apache server has been successfully deployed.

Since we finished the first step, let’s proceed to our next step, installing mySQL.

Installation of MySQL

MySQL is a database software provide front-end service and PHP information to process.

Type sudo apt install mysql-server in the terminal, after completion, type sudo mysql_secure_installation to eliminate unsecure factors.

After installation, use sudo mysqlto test if it has been install correctly.

Oops, in this time, the terminal throwed me an error with

ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2)

After checking with StackOverflow, I opened the config file using

sudo nano /etc/mysql/my.cnf

I found out that I have installed MariaDB before, so I have to uninstall the MariaDB.

Using Aptitude to locate the package name of MariaDB, command by sudo aptitude.

And, uninstall MariaDB by sudo apt remove mariadb-common.

Let’s try again.

The issue consists.

Let’s reinstall.

The issue consists. (Sigh)

After two hours of Googling and trying, I decided to give up and install mariadb.

Installation of PHP

Finally, we come to the point where the installation of PHP takes place.

Proceed sudo apt install php libapache2-mod-php

to install PHP.

After that, proceed sudo vim /etc/apache2/mods-enabled/dir.conf

to open the configuration file of Apache server.

Modify the priority of index.php second to DirectoryIndex, save and restart the Apache Server by

sudo systemctl restart apache2

and access

http://localhost

.

If you see the page of PHP status, congrats again! You’ve finished all necessary steps to avail a dev environment.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值