About phptuts

Author Archive | phptuts

Date setTimezoneOffset method

As you all know, all date methods work only in the context of local time (user) or UTC, but sometimes you want to work in other contexts (time zones), the standard js forgot about the antagonist for getTimezoneOffset, and this is my method: Result:

Read full story Comments { 0 }

How to chmod folders or files only

To chmod folders only, you can use command: To chmod files only, you can use command:

Read full story Comments { 0 }

Using FTP with VPSSIM on CentOS

Use vpssim menu: Choose menu 9 then choose sub-menu 5 to setup FTP server: Now you will see this screen: Type 1 to create an FTP account, then type your domain like: tutorialspots.com

Read full story Comments { 0 }

How to create websocket secure by using NodeJS

Method 1: In this article: How to run a https website with Nodejs, express and socket.io Method 2: use NGINX file .conf Now, you can use websocket to create websocket secure: Read more: Example chat application using Nodejs + Socket.io Example chat application using Nodejs + ws Example chat application using Nodejs + Websocket

Read full story Comments { 0 }

How to create a free Let’s Encrypt certificate on CentOS with NGINX

Step 1: Step 2: Result: Result: You can use crond to run below command twice per day: https://certbot.eff.org/#centos6-nginx

Read full story Comments { 1 }

How to run a https website with Nodejs, express and socket.io

Step 1: generate RSA key Use command line: (on Windows we can use Cygwin) Result: Step 2: create file csr.pem Result: Step 3: create SSL certificate file Result: Note: this is in practice, in production you must buy one certificate or use free SSL Step 4: continue with Nodejs app here an example app: app.js […]

Read full story Comments { 1 }

How to install bmon – Bandwidth Monitor on CentOS

bmon is a monitoring and debugging tool to capture networking related statistics and prepare them visually in a human friendly way. It features various output methods including an interactive curses user interface and a programmable text output for scripting. If your server hasn’t git, follow guide: How to install Git on Centos Linux I install […]

Read full story Comments { 0 }

Linux: Cron job to monitor for php-fpm service problem

Sometimes, php-fpm service is error, how to monitor for php-fpm service ? Step 1: create a file like check.php with a simple content like and upoad this file to document root (like: /home/vpssim.demo/public_html), you will have the link: http://localhost/check.php Step 2: add a cron job: You can use the command line Then type: i Then […]

Read full story Comments { 0 }

How to reset MariaDb root password on Linux

You forgot or you unknow your root MYSQL password! How to reset MariaDb root password on Linux? Step 1: stop MariaDb Result: Step 2: Result: Step 3: stop and start Mariadb service Note: You can’t use command service mysql restart

Read full story Comments { 0 }

PHP array_shift equivalent in golang

We use reflect as the example: Result:

Read full story Comments { 0 }