Home Backend Development PHP Tutorial linux系统下搭建php环境之-Discuz论坛

linux系统下搭建php环境之-Discuz论坛

Jun 21, 2016 am 08:45 AM

 1、安装搭建论坛必要的软件 apache  php  mysql

       CentOS系统我们可以直接使用 yum install 的方式进行软件安装,腾讯云有提供软件安装源,是同步CentOS官方的安装源,包涵的软件都是当前最稳定的版本,因此直接安装即可

       yum install -y httpd php php-fpm mysql mysql-server php-mysql


 2、将相应服务启动

      我们安装的apache php mysql这些软件都是以服务的形式在服务器中的,注意这里通常我们所说的web服务都是指的apache,而不是服务器本身

       service httpd start

       service mysqld start

       service php-fpm start

       这三个命令输入完毕之后代表网站的环境基本已经完成,接下来执行  netstat -tunlp 来检查服务的运行情况

这样我们可以看到httpd(也就是apache服务)监听80端口,mysql监听3306端口,php-fpm监听9000端口,并且都已经正常启动

      这时,我们的环境已经基本搭建好了,大家已经可以在浏览器中访问服务器的外网ip,可以看到apache的测试页面,就说明你已经成功了。为了保险起见,也建议大家进入到apache的web根目录:/var/www/html 中自己写一个最简单的php页面

      cd /var/www/html

      touch test.php

      vi test.php 进入到了控制模式之后再摁下键盘字母 i 进入到编辑模式,将如下代码复制粘贴到编辑模式中

     

      echo "

Test Page";

      phpinfo()

      ?>

      然后在编辑模式下摁键盘 esc 退出编辑模式,回到控制模式,在控制模式下摁键盘 : (冒号 shift+;),再输入wq 然后回车。可以再执行 cat test.php 命令,看到下图情况说明test.php文件已经编辑成功

       大家可以在浏览器中访问 外网ip/test.php 看到如下页面,那么你已经完成环境搭建的80%

       3、最后20%问题来自mysql的简单配置

       因为discuz论坛要用到mysql数据库,因此我们要为mysql设置相应的用户去访问管理,之前我们已经启动了mysqld服务,因此此时我们需要给mysql设定,一个初始的root密码,可以让root用户去访问数据库

       mysqladmin -u root password "XXXXXXXX"

       这样我们就设置好了mysql的密码,可以输入 mysql -u root -p ,然后再输入刚刚设定好的密码,就可以进入到数据库中,这样说明你已经完全配置好了discuz所需的环境,下一步就是上传代码了

        4、上传下载好的discuz论坛代码

        这里如果各位嫌FTP麻烦,推荐使用winscp软件上传(可以参考官网wiki文档),将代码上传到服务器的apache web根目录下,即/var/www/html 下。 如何使用winscp软件这里不再赘述了。

        5、将目录赋予相应权限

        这些目录文件上传到服务器之后,默认只有root用户才有写权限,所以我们还要将写权限赋予给其他用户

        chmod -R 777 /var/www/html

        至此,论坛已经完全搭建完毕,各位可以在浏览器中访问 外网ip/install 去进行安装了。

        在安装过程中需要注意的主要是第三步,数据库安装操作,这里数据库服务器就写localhost即可,数据库名不用管,数据库用户名写root,数据库密码就是之前设定好的mysql密码

        至此discuz论坛搭建已经完成了,也希望大家在软件使用、环境搭建方面有什么经历和感受和大家共同交流一下!



Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Roblox: Bubble Gum Simulator Infinity - How To Get And Use Royal Keys
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Nordhold: Fusion System, Explained
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Mandragora: Whispers Of The Witch Tree - How To Unlock The Grappling Hook
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1670
14
PHP Tutorial
1274
29
C# Tutorial
1256
24
Explain secure password hashing in PHP (e.g., password_hash, password_verify). Why not use MD5 or SHA1? Explain secure password hashing in PHP (e.g., password_hash, password_verify). Why not use MD5 or SHA1? Apr 17, 2025 am 12:06 AM

In PHP, password_hash and password_verify functions should be used to implement secure password hashing, and MD5 or SHA1 should not be used. 1) password_hash generates a hash containing salt values ​​to enhance security. 2) Password_verify verify password and ensure security by comparing hash values. 3) MD5 and SHA1 are vulnerable and lack salt values, and are not suitable for modern password security.

PHP and Python: Comparing Two Popular Programming Languages PHP and Python: Comparing Two Popular Programming Languages Apr 14, 2025 am 12:13 AM

PHP and Python each have their own advantages, and choose according to project requirements. 1.PHP is suitable for web development, especially for rapid development and maintenance of websites. 2. Python is suitable for data science, machine learning and artificial intelligence, with concise syntax and suitable for beginners.

PHP in Action: Real-World Examples and Applications PHP in Action: Real-World Examples and Applications Apr 14, 2025 am 12:19 AM

PHP is widely used in e-commerce, content management systems and API development. 1) E-commerce: used for shopping cart function and payment processing. 2) Content management system: used for dynamic content generation and user management. 3) API development: used for RESTful API development and API security. Through performance optimization and best practices, the efficiency and maintainability of PHP applications are improved.

How does PHP type hinting work, including scalar types, return types, union types, and nullable types? How does PHP type hinting work, including scalar types, return types, union types, and nullable types? Apr 17, 2025 am 12:25 AM

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.

The Enduring Relevance of PHP: Is It Still Alive? The Enduring Relevance of PHP: Is It Still Alive? Apr 14, 2025 am 12:12 AM

PHP is still dynamic and still occupies an important position in the field of modern programming. 1) PHP's simplicity and powerful community support make it widely used in web development; 2) Its flexibility and stability make it outstanding in handling web forms, database operations and file processing; 3) PHP is constantly evolving and optimizing, suitable for beginners and experienced developers.

PHP and Python: Different Paradigms Explained PHP and Python: Different Paradigms Explained Apr 18, 2025 am 12:26 AM

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 and Python: Code Examples and Comparison PHP and Python: Code Examples and Comparison Apr 15, 2025 am 12:07 AM

PHP and Python have their own advantages and disadvantages, and the choice depends on project needs and personal preferences. 1.PHP is suitable for rapid development and maintenance of large-scale web applications. 2. Python dominates the field of data science and machine learning.

How do you prevent SQL Injection in PHP? (Prepared statements, PDO) How do you prevent SQL Injection in PHP? (Prepared statements, PDO) Apr 15, 2025 am 12:15 AM

Using preprocessing statements and PDO in PHP can effectively prevent SQL injection attacks. 1) Use PDO to connect to the database and set the error mode. 2) Create preprocessing statements through the prepare method and pass data using placeholders and execute methods. 3) Process query results and ensure the security and performance of the code.

See all articles