Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Situation Awareness
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive
On this page

Setting Up a ThinkPHP Framework

Updated on 2024-11-04 GMT+08:00

Overview

ThinkPHP, a free, open-source, fast, and simple object-oriented lightweight PHP development framework, is released under the Apache2 open source protocol and is designed for developing agile web applications and simple enterprise applications. The section guides you through the setup of ThinkPHP using an ECS running CentOS 7.2 on Huawei Cloud.

Prerequisites

  • You have purchased an ECS and bound an EIP to it.
  • The rule listed in the following table has been added to the security group which the target ECS belongs to. For details, see Adding a Security Group Rule.
    Table 1 Security group rules

    Direction

    Priority

    Action

    Type

    Protocol & Port

    Source Address

    Inbound

    1

    Allow

    IPv4

    TCP: 22

    0.0.0.0/0

    Inbound

    1

    Allow

    IPv4

    TCP: 443

    0.0.0.0/0

    Inbound

    1

    Allow

    IPv4

    TCP: 8000

    0.0.0.0/0

  • To obtain and update the system and software, you are advised to update the image source to a Huawei Cloud image source. For details, see How Can I Use an Automated Tool to Configure a Huawei Cloud Image Source (x86_64 and Arm)?

Procedure

  1. Install PHP.
    1. Run the following commands to install the EPEL and REMI repositories:

      sudo yum install -y epel-release

      sudo yum install -y https://rpms.remirepo.net/enterprise/remi-release-7.rpm

    2. Run the following commands to enable the PHP 8.0 repository:

      sudo yum -y install yum-utils

      sudo yum-config-manager --enable remi-php80

    3. Run the following commands to install PHP:

      sudo yum install -y php php-cli php-fpm php-mysqlnd php-zip php-devel php-gd php-mcrypt php-mbstring php-curl php-xml php-pear php-bcmath php-json

    4. Run the following command to check the version of the installed PHP:

      php -v

      Information similar to the following is displayed:

      PHP 8.0.30 (cli) (built: Jun  4 2024 15:19:49) ( NTS gcc x86_64 )
      Copyright (c) The PHP Group
      Zend Engine v4.0.30, Copyright (c) Zend Technologies  
  2. Install Composer.

    Composer is a package manager for the PHP programming language that provides a standard format for managing dependencies of PHP software and required libraries.

    1. Run the following command to install the dependencies required by Composer:

      sudo yum install -y unzip git

    2. Run the following commands to install Composer:

      curl -sS https://getcomposer.org/installer | php

      sudo mv composer.phar /usr/local/bin/composer

    3. Run the following command to check the version of the installed Composer:

      composer --version

      Information similar to the following is displayed:
      Composer version 2.7.7 2024-06-10 22:11:12
      PHP version 8.0.30 (/usr/bin/php)
  3. Install ThinkPHP.
    1. Use Composer to create a new ThinkPHP application.

      Run the following command to create my-thinkphp-app in the current directory and download the core files and dependencies of ThinkPHP:

      composer create-project topthink/think my-thinkphp-app

    2. Run the following commands to switch to the created directory and start the ThinkPHP built-in server for development:

      cd my-thinkphp-app

      php think run

      If information similar to the following is displayed, ThinkPHP has been started:

    3. After the installation is complete, enter http://ECS EIP:8000 in the address bar of the browser. If the following page is displayed, ThinkPHP has been installed.

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback