Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Installation and use of tars php

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces "the installation and use of tars php". In the daily operation, I believe that many people have doubts about the installation and use of tars php. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts about "installation and use of tars php". Next, please follow the editor to study!

1. Install the core components of tars

Https://github.com/TarsCloud/...

Details can basically be installed according to the official documentation. If there is an error, check the log.

2. Install web interface management

Cd / usr/local/tarsgit clone https://github.com/TarsCloud/TarsWeb.gitcd / usr/local/tars/TarsWeb

Replace profile

Sed-I 's/db.tars.com/ your ip/g' config/webConf.jssed-I' s/registry.tars.com/ your ip/g' config/tars.conf

Installation

$npm install-- registry= https://registry.npm.taobao.org$ npm run prd

For specific error reports, you can check the log what cat / root/.npm/_logs/ is missing and what to install.

Open port 3000 to see the interface

3. Install tarsphp and official examples, require php5.6 or above, and install swoole extension, redis extension, phptars extension.

Installation of swoole and redis extensions will not be discussed here

Phptars extension installation

Git clone https://github.com/TarsPHP/tars-extension.gitcd / opt/tars/TarsPHP/tars-extension / usr/local/php7.2.10/bin/phpize./configure./configure-- with-php-config=/usr/local/php7.2.10/etc/php.ini./configure-- with-php-config=/usr/local/php7.2.10/bin/php-configmake install

Modify php.ini configuration to support extension

View extension installation

/ usr/local/php7.2.10/bin/php-m

Download tarsphp development

Git clone https://github.com/TarsPHP/Ta...

After downloading, you can see the official example TarsActDemo.

On-screen comment activity project, which contains 3 services.

It covers Http,Tcp services and uses Mysql,Redis storage, including user login, session verification, user information acquisition, on-screen comment creation, on-screen comment acquisition and other functions. It already covers many aspects of normal business development.

QD.ActHttpServer.obj is a http service that provides fixed ports, which is a business service that calls back-end User and Comment services to complete the business.

QD.ActCommentServer.CommentObj is a tcp service that mainly provides the writing and retrieval of comments, which are stored in Redis.

QD.UserService.UserObj is a tcp, which mainly provides user information acquisition, user login, user Session verification. The relevant data is stored in Mysql.

Index.html is the front-end page, which connects to the http service to realize the on-screen display.

Act.tars.local.conf is a nginx configuration

User_info.sql is a table of user information for QD.UserServer services

1)。 Modify the mysql configuration in src/ENVConf.php in QD.UserService and set your own mysql ip, port and db names

2)。 Import user_info.sql into your mysql.

3)。 Modify the redis configuration in src/ENVConf.php in QD.ActCommentServer and set your own redis ip and port

4)。 Cd to the src directory of each service, execute composer install, and install composer dependencies

5)。 Cd to the src directory of each service in turn, and execute the composer run-script deploy packaging code

6)。 Deploy three services. QD.ActHttpServer is a http service, which requires a fixed port. Select a non-tars service, and you need to create a new publishing template.

Enableset=$ {enableset} setdivision=$ {setdivision} locator=$ {locator} sync-invoke-timeout=20000 async-invoke-timeout=20000 refresh-endpoint-interval=60000 stat=tars.tarsstat.StatObj property=tars.tarsproperty.PropertyObj report-interval=60000 modulename=$ {modulename} sample-rate=100000 max-sample-count=50 app=$ {app} server=$ {server} localip=$ {localip} local=$ {local} basepath=$ {basepath} datapath=$ {datapath} logpath=$ {logpath} loglevel=DEBUG logsize=15M log=tars.tarslog.LogObj config=tars.tarsconfig.ConfigObj notify=tars.tarsnotify.NotifyObj logLevel=DEBUG php=/usr/local/php7.2.10/bin/php buffer_output_size=12582912 Open_tcp_nodelay=1 open_eof_check=0 open_eof_split=0 task_worker_num=1 dispatch_mode=2 daemonize=1 protocolName=http

The other two are tcp services, the port is arbitrary, choose tars service.

(note that during deployment, the ServantName configured on the platform should be the same as the full name I wrote above. If you need to modify it, please modify tars.proto.php,actComment.proto.php and userInfo.proto.php synchronously, and generate the code in protocol.)

7)。 Configure your nginx,proxy_pass to modify the ip address and port of your QD.ActHttpServer service

8)。 Copy index.html to your / data/website/tarsact/

9)。 Open it and see if you can access it.

10)。 Enter a user name, yong password 123456, to perform the following login

11)。 Try to send a barrage.

12)。 Refresh it. Has the barrage you sent out yet? Congratulations O (∩ _ ∩) O ~

At this point, the study on "installation and use of tars php" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report