CentOS 6.5 搭建 LAMP 环境,centoslamp
目录
第一步: 安装和配置Apache服务器
第二步: 设置、绑定站点目录文件
第三步: 安装MYSQL数据库
第四步: 安装PHP环境
总结
>>Begin:
第一步: 安装和配置Apache服务器
<p>yum update #更新 yum<br />yum install httpd # 使用 yum 安装 httpd (httpd 就是 Apache 服务器) 点击->了解 yum</p>
安装当前版本的Apache配置环境,然后配置httpd.conf(位置在/etc/httpd/conf/httpd.conf)文件.也可以直接使用默认的配置文件。
<p>KeepAlive Off<br />......<br /><IfModule prefork.c><br />StartServers 2<br />MinSpareServers 6<br />MaxSpareServers 12<br />MaxClients 80<br />MaxRequestsPerChild 3000<br /></IfModule></p>
配置的时候不是要把里面设置都删除,而是对应的参数修改。
第二步: 设置、绑定站点目录文件
手工安装LAMP不同于用一键包直接用命令就可以添加域名建立站点,这些所有都要用手工操作,比如我们这里需要添加域名建立站点。
<p>vim /etc/httpd/conf.d/vhost.conf #vim 是 Unix/Linux 下的编辑工具; 此命令的意思: 在<span> /etc/httpd/conf.d/</span> 目录下建立 <span>vhost.conf</span> 文本配置文件</p>
在上述的目录下建立vhost.conf文件,然后配置站点
<p>NameVirtualHost *:80</p> <p><VirtualHost *:80><br /><span>ServerAdmin</span> admin@laozuo.org<br /><span>ServerName</span> laozuo.org<br /><span>ServerAlias</span> www.laozuo.org<br /><span>DocumentRoot</span> /srv/www/laozuo.org/public_html/<br /><span>ErrorLog</span> /srv/www/laozuo.org/logs/error.log<br /><span>CustomLog</span> /srv/www/laozuo.org/logs/access.log combined<br /></VirtualHost></p> <p><VirtualHost *:80><br />ServerAdmin admin@idcxen.com<br />ServerNameidcxen.com<br />ServerAlias www.idcxen.com<br />DocumentRoot /srv/www/idcxen.com/public_html/<br />ErrorLog /srv/www/idcxen.com/logs/error.log<br />CustomLog /srv/www/idcxen.com/logs/access.log combined<br /></VirtualHost></p>
我们在上面文件中可以看到是添加2个站点,如果是添加多个站点类似的复制修改对应的目录。同样的,我们需要对应的目录创建没有的目录路径。
<p>mkdir -p /srv/www/laozuo.org/public_html<br />mkdir /srv/www/laozuo.org/logs</p> <p>mkdir -p /srv/www/idcxen.com/public_html<br />mkdir /srv/www/idcxen.com/logs</p>
对应的目录路径比如srv是我创建的,如果有需要其他路径我们根据自己的需要自己创建。
启动httpd以及设置开机启动。
<p>/etc/init.d/httpd start<br />/sbin/chkconfig --levels 235 httpd on<br />/etc/init.d/httpd reload</p>
第三步: 安装MYSQL数据库
A - 安装并且启动
<p>yum install mysql-server #安装MYSQL服务</p> <p>/sbin/chkconfig --levels 235 mysqld on # 设置开机启动</p> <p>/etc/init.d/mysqld start # 启动MYSQL</p>
B - 设置数据库用户
<p>mysql_secure_installation #安装设置ROOT权限,根据提示设置ROOT密码</p>
此安装过程中, 你可以通过选择, 移除默认的其他用户和其他默认数据。
<p>mysql -u root -p # 登录ROOT数据库用户</p>
第四步: 安装PHP环境
<p>yum install php php-pear #使用yum 安装 php 环境 </p>
安装PHP环境,然后配置/etc/php.ini文件。
<p>error_reporting = E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR<br />display_errors = Off<br />log_errors = On<br />error_log = /var/log/php/error.log<br />max_execution_time = 30<br />memory_limit = 128M<br />register_globals = Off<br />max_input_time = 30</p>
用vi寻找上述的几个参数,然后对应进行修改参数,保存退出。
创建日志文件,如果我们需要支持MYSQL在PHP中,需要输入下面的命令安装php5-mysql包。
<p>mkdir /var/log/php<br />chown apache /var/log/php</p>
安装并设置启动。
<p>yum install php-mysql<br />/etc/init.d/httpd restart</p>
总结:
这样,我们的域名站点绑定、MYSQL数据库都已经添加,比如我们需要在laozuo.org域名下安装WORDPRESS程序或者其他程序,只需要在/srv/www/laozuo.org/public_html/目录下上传程序,然后利用设置的数据库用户安装就可以了。
另外, 也要会使用 vim 编辑文件(vim 学习参考), 会使用基本的 Unix/Linux 命令(Linux 命令学习参考);
本文主体内容参考: 老左博客

What’s still popular is the ease of use, flexibility and a strong ecosystem. 1) Ease of use and simple syntax make it the first choice for beginners. 2) Closely integrated with web development, excellent interaction with HTTP requests and database. 3) The huge ecosystem provides a wealth of tools and libraries. 4) Active community and open source nature adapts them to new needs and technology trends.

PHP and Python are both high-level programming languages that are widely used in web development, data processing and automation tasks. 1.PHP is often used to build dynamic websites and content management systems, while Python is often used to build web frameworks and data science. 2.PHP uses echo to output content, Python uses print. 3. Both support object-oriented programming, but the syntax and keywords are different. 4. PHP supports weak type conversion, while Python is more stringent. 5. PHP performance optimization includes using OPcache and asynchronous programming, while Python uses cProfile and asynchronous programming.

PHP is mainly procedural programming, but also supports object-oriented programming (OOP); Python supports a variety of paradigms, including OOP, functional and procedural programming. PHP is suitable for web development, and Python is suitable for a variety of applications such as data analysis and machine learning.

PHP originated in 1994 and was developed by RasmusLerdorf. It was originally used to track website visitors and gradually evolved into a server-side scripting language and was widely used in web development. Python was developed by Guidovan Rossum in the late 1980s and was first released in 1991. It emphasizes code readability and simplicity, and is suitable for scientific computing, data analysis and other fields.

PHP is suitable for web development and rapid prototyping, and Python is suitable for data science and machine learning. 1.PHP is used for dynamic web development, with simple syntax and suitable for rapid development. 2. Python has concise syntax, is suitable for multiple fields, and has a strong library ecosystem.

PHP remains important in the modernization process because it supports a large number of websites and applications and adapts to development needs through frameworks. 1.PHP7 improves performance and introduces new features. 2. Modern frameworks such as Laravel, Symfony and CodeIgniter simplify development and improve code quality. 3. Performance optimization and best practices further improve application efficiency.

PHPhassignificantlyimpactedwebdevelopmentandextendsbeyondit.1)ItpowersmajorplatformslikeWordPressandexcelsindatabaseinteractions.2)PHP'sadaptabilityallowsittoscaleforlargeapplicationsusingframeworkslikeLaravel.3)Beyondweb,PHPisusedincommand-linescrip

PHP type prompts to improve code quality and readability. 1) Scalar type tips: Since PHP7.0, basic data types are allowed to be specified in function parameters, such as int, float, etc. 2) Return type prompt: Ensure the consistency of the function return value type. 3) Union type prompt: Since PHP8.0, multiple types are allowed to be specified in function parameters or return values. 4) Nullable type prompt: Allows to include null values and handle functions that may return null values.


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

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Dreamweaver Mac version
Visual web development tools

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

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

WebStorm Mac version
Useful JavaScript development tools