Lamp(linux+apache+mysql+php)环境搭建
Lamp(linux+apache+mysql+php)环境搭建
1.安装apache2:sudo apt-get installapache2
安装完成后,运行如下命令重启apache:sudo/etc/init.d/apache2 restart,在浏览器中输入http://localhost或者http://127.0.0.1,会看到"It works!"说明apache安装成功。
2.安装php:sudoapt-get install libapache2-mod-php5 php5;
安装扩展php5-gd:sudo apt-get installlibapache2-mod-php5 php5-gd
php5-mysql:sudo apt-get install libapache2-mod-php5 php5-mysql
安装完成后,重新启动apache,让它加载PHP模块:sudo /etc/init.d/apache2 restart
接下来再Web目录下面新建一个PHP文件来测试PHP是否能正常运行:
sudo gedit /var/www/phpinfo.php,输入并保存后在浏览器里输入http://localhost/phpinfo.php,如果出现了显示php运行参数的页面则说明PHP可以正常运行。
phpinfo();
?php>
3.安装mysql:sudo apt-get installmysql-server mysql-client,在安装的最后需要输入root密码,这里的root密码是指设定MySQL的root密码。
4.安装phpmyadmin-Mysql数据库管理:
sudo apt-get installlibapache2-mod-auth-mysql php5-mysql phpmyadmin,这样安装与php5相配合的phpmyadmin。安装phpmyadmin后,配置phpmyadmin和apache2:
cp /etc/phpmyadmin/apache.conf /etc/apache2/sites-available/phpmyadmin,将phpmyadmin中的apache.conf(apache配置文件)复制到apache2/sites-available下的phpmyadmin文件下,然后进入sites-enabled文件夹下:
cd/etc/apache2/sites-enabled,建立一个通往配置文件的链接:sudo ln -s../sites-available/phpmyadmin,重启apache2:sudo /etc/init.d/apache2restart。最后可以打开http://localhost/phpmyadmin验证一下。这样LAMP的基本组件安装完毕了。
/********************************************************************************/
接下来进行一些其他的设置:
1.PHP网络服务器根目录默认设置是在:/var/www,由于Linux系统的安全性原则,改目录下的文件读写权限只允许root用户操作,因此通过制定root终端命令:sudo chmod 777 /var/www修改/var/www目录的读写权限,然后就可以写入html或php文件了。
2.配置apahce:启用mod_rewrite模块sudo a2enmod rewrite,重启apache服务器sudo /etc/init.d/apache2 restart,在/var/www目录下新建文件test.php,写入代码保存,然后在浏览器输入http://127.0.0.1/test.php,如果出现php配置信息则表明LAMP Apache已经正常工作(重启apache服务器后测试)。
设置apache支持.htm .html .php:sudo gedit /etc/apache2/apache2.conf
在打开的文件中加上AddType application/x-httpd-php .php .htm .html即可。

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











In this article, we will learn about the differences between Python and Anaconda. What is Python? Python is an open source language that places great emphasis on making the code easy to read and understand by indenting lines and providing whitespace. Python's flexibility and ease of use make it ideal for a variety of applications, including but not limited to scientific computing, artificial intelligence, and data science, as well as creating and developing online applications. When Python is tested, it is immediately translated into machine language because it is an interpreted language. Some languages, such as C++, require compilation to be understood. Proficiency in Python is an important advantage because it is very easy to understand, develop, execute and read. This makes Python

Windows Recovery Environment (WinRE) is an environment used to repair Windows operating system errors. After entering WinRE, you can perform system restore, factory reset, uninstall updates, etc. If you are unable to boot into WinRE, this article will guide you through fixes to resolve the issue. Unable to boot into the Windows Recovery Environment If you cannot boot into the Windows Recovery Environment, use the fixes provided below: Check the status of the Windows Recovery Environment Use other methods to enter the Windows Recovery Environment Did you accidentally delete the Windows Recovery Partition? Perform an in-place upgrade or clean installation of Windows below, we have explained all these fixes in detail. 1] Check Wi

How to quickly build a statistical chart system under the Vue framework. In modern web applications, statistical charts are an essential component. As a popular front-end framework, Vue.js provides many convenient tools and components that can help us quickly build a statistical chart system. This article will introduce how to use the Vue framework and some plug-ins to build a simple statistical chart system. First, we need to prepare a Vue.js development environment, including installing Vue scaffolding and some related plug-ins. Execute the following command in the command line

Players can collect different materials to build buildings when playing in the Mistlock Kingdom. Many players want to know whether to build buildings in the wild. Buildings cannot be built in the wild in the Mistlock Kingdom. They must be within the scope of the altar. . Can buildings be built in the wild in Mistlock Kingdom? Answer: No. 1. Buildings cannot be built in the wild areas of the Mist Lock Kingdom. 2. The building must be built within the scope of the altar. 3. Players can place the Spirit Fire Altar by themselves, but once they leave the range, they will not be able to construct buildings. 4. We can also directly dig a hole in the mountain as our home, so we don’t need to consume building materials. 5. There is a comfort mechanism in the buildings built by players themselves, that is to say, the better the interior, the higher the comfort. 6. High comfort will bring attribute bonuses to players, such as

PyTorch Installation Guide: Quickly set up a development environment in PyCharm PyTorch is one of the most popular frameworks in the current field of deep learning. It has the characteristics of ease of use and flexibility, and is favored by developers. This article will introduce how to quickly set up the PyTorch development environment in PyCharm, so that you can start the development of deep learning projects. Step 1: Install PyTorch First, we need to install PyTorch. The installation of PyTorch usually needs to take into account the system environment

Setting environment variables on Windows 11 can help you customize your system, run scripts, and configure applications. In this guide, we'll discuss three methods along with step-by-step instructions so you can configure your system to your liking. There are three types of environment variables System environment variables – Global variables are the lowest priority and are accessible to all users and applications on Windows and are typically used to define system-wide settings. User Environment Variables – Higher priority, these variables only apply to the current user and process running under that account, and are set by the user or application running under that account. Process environment variables – have the highest priority, they are temporary and apply to the current process and its sub-processes, providing the program

Best practices and precautions for building web servers under CentOS7 Introduction: In today's Internet era, web servers are one of the core components for building and hosting websites. CentOS7 is a powerful Linux distribution widely used in server environments. This article will explore the best practices and considerations for building a web server on CentOS7, and provide some code examples to help you better understand. 1. Install Apache HTTP server Apache is the most widely used w

With the rapid development of mobile Internet, the short video application Douyin has become an indispensable part of people's daily lives. Having a popular Douyin account can not only attract the attention of fans, but also bring commercial value. So, how to set up the best Douyin account? 1. What is the best way to set up a Douyin account? 1. Clear positioning When creating a Douyin account, you must first clarify your positioning. Do you want to be a funny joker or a professional knowledge sharer? Clear positioning can help attract precise fans, thereby increasing the value of your account. 2. Account naming: A good account name can make fans remember you at a glance. The account name should be concise and clear, related to your positioning, and have a certain degree of creativity. Avoid using names that are too common to avoid confusion with others
