Create a php script with following content
1 2 3 4 5 6 7 |
<?php echo "<pre>"; foreach (get_loaded_extensions() as $extn) { echo $extn . "\n"; } |
See php […]
Create a php script with following content
1 2 3 4 5 6 7 |
<?php echo "<pre>"; foreach (get_loaded_extensions() as $extn) { echo $extn . "\n"; } |
See php […]
Install Install Node.js on CentOS Install Node.js on Debian/Ubuntu Node.Js Version Manager Installing nvm (Node.js Version Manager) n – node version manager Node.js Tips nodemon pm2 process manager for node.js […]
n is node version manager. To install, run
1 |
npm install n -g |
To list versions of node.js available, run
1 |
n ls |
To install latest stable node.js
1 |
n stable |
Node.Js […]
To create a PHP script to sent email using Amazon SES, create a folder
1 2 |
mkdir ses-test cd ses-test |
Install phpMailer using composer
1 |
composer require phpmailer/phpmailer |
Create a PHP file with following content
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
<?php use PHPMailer\PHPMailer\PHPMailer; use PHPMailer\PHPMailer\Exception; require 'vendor/autoload.php'; $mail = new PHPMailer(true); try { //Server settings $mail->SMTPDebug = 2; $mail->isSMTP(); $mail->Host = 'email-smtp.us-east-1.amazonaws.com'; // YOUR SES END POINT $mail->SMTPAuth = true; $mail->Username = 'AKIAJSKJUHBOU2ARXVLQ'; // SMTP Username $mail->Password = 'AjMmd3gRkmTyCY2QoCDkWmkGKA345zuhseS7gV0X6uz0'; // SMTP Password $mail->SMTPSecure = 'tls'; $mail->Port = 587; //Recipients $mail->addAddress('[email protected]', 'Your Name'); // If your SES is in Sandbox, you need to verify your email. //Content $mail->isHTML(true); // Set email format to HTML $mail->Subject = 'Here is the subject'; $mail->Body = 'This is the HTML message body <b>in bold!</b>'; $mail->AltBody = 'This is the body in plain text for non-HTML mail clients'; $mail->send(); echo 'Message has been sent'; } catch (Exception $e) { echo 'Message could not be sent.'; echo 'Mailer Error: ' . $mail->ErrorInfo; } |
Now test it by running
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
root@ok:~/ses-test# php 1.php 2018-01-15 08:45:54 SERVER -> CLIENT: 220 email-smtp.amazonaws.com ESMTP SimpleEmailService-2762711029 fDkTVziQIcNhSCkxwSpA 2018-01-15 08:45:54 CLIENT -> SERVER: EHLO ok 2018-01-15 08:45:54 SERVER -> CLIENT: 250-email-smtp.amazonaws.com 250-8BITMIME 250-SIZE 10485760 250-STARTTLS 250-AUTH PLAIN LOGIN 250 Ok 2018-01-15 08:45:54 CLIENT -> SERVER: STARTTLS 2018-01-15 08:45:54 SERVER -> CLIENT: 220 Ready to start TLS 2018-01-15 08:45:54 CLIENT -> SERVER: EHLO ok 2018-01-15 08:45:54 SERVER -> CLIENT: 250-email-smtp.amazonaws.com 250-8BITMIME 250-SIZE 10485760 250-STARTTLS 250-AUTH PLAIN LOGIN 250 Ok 2018-01-15 08:45:54 CLIENT -> SERVER: AUTH LOGIN 2018-01-15 08:45:54 SERVER -> CLIENT: 334 VXNlcm5hbWU6 2018-01-15 08:45:54 CLIENT -> SERVER: <credentials hidden> 2018-01-15 08:45:54 SERVER -> CLIENT: 334 UGFzc3dvcmQ6 2018-01-15 08:45:54 CLIENT -> SERVER: <credentials hidden> 2018-01-15 08:45:54 SERVER -> CLIENT: 235 Authentication successful. 2018-01-15 08:45:54 CLIENT -> SERVER: MAIL FROM:<info@hostonnet.com> 2018-01-15 08:45:54 SERVER -> CLIENT: 250 Ok 2018-01-15 08:45:54 CLIENT -> SERVER: RCPT TO:<info@serverok.in> 2018-01-15 08:45:54 SERVER -> CLIENT: 250 Ok 2018-01-15 08:45:54 CLIENT -> SERVER: DATA 2018-01-15 08:45:54 SERVER -> CLIENT: 354 End data with <CR><LF>.<CR><LF> 2018-01-15 08:45:54 CLIENT -> SERVER: Date: Mon, 15 Jan 2018 03:45:54 -0500 2018-01-15 08:45:54 CLIENT -> SERVER: To: Yujin Boby <info@serverok.in> 2018-01-15 08:45:54 CLIENT -> SERVER: From: "hostonnet.com" <info@hostonnet.com> 2018-01-15 08:45:54 CLIENT -> SERVER: Reply-To: "hostonnet.com" <info@hostonnet.com> 2018-01-15 08:45:54 CLIENT -> SERVER: Subject: Here is the subject 2018-01-15 08:45:54 CLIENT -> SERVER: Message-ID: <4Px5PcyItpZIBJeyp03zA7sVd6uBkNPwuctLKMLeU4@ok> 2018-01-15 08:45:54 CLIENT -> SERVER: X-Mailer: PHPMailer 6.0.3 (https://github.com/PHPMailer/PHPMailer) 2018-01-15 08:45:54 CLIENT -> SERVER: MIME-Version: 1.0 2018-01-15 08:45:54 CLIENT -> SERVER: Content-Type: multipart/alternative; 2018-01-15 08:45:54 CLIENT -> SERVER: boundary="b1_4Px5PcyItpZIBJeyp03zA7sVd6uBkNPwuctLKMLeU4" 2018-01-15 08:45:54 CLIENT -> SERVER: Content-Transfer-Encoding: 8bit 2018-01-15 08:45:54 CLIENT -> SERVER: 2018-01-15 08:45:54 CLIENT -> SERVER: This is a multi-part message in MIME format. 2018-01-15 08:45:54 CLIENT -> SERVER: --b1_4Px5PcyItpZIBJeyp03zA7sVd6uBkNPwuctLKMLeU4 2018-01-15 08:45:54 CLIENT -> SERVER: Content-Type: text/plain; charset=us-ascii 2018-01-15 08:45:54 CLIENT -> SERVER: 2018-01-15 08:45:54 CLIENT -> SERVER: This is the body in plain text for non-HTML mail clients 2018-01-15 08:45:54 CLIENT -> SERVER: 2018-01-15 08:45:54 CLIENT -> SERVER: --b1_4Px5PcyItpZIBJeyp03zA7sVd6uBkNPwuctLKMLeU4 2018-01-15 08:45:54 CLIENT -> SERVER: Content-Type: text/html; charset=us-ascii 2018-01-15 08:45:54 CLIENT -> SERVER: 2018-01-15 08:45:54 CLIENT -> SERVER: This is the HTML message body <b>in bold!</b> 2018-01-15 08:45:54 CLIENT -> SERVER: 2018-01-15 08:45:54 CLIENT -> SERVER: 2018-01-15 08:45:54 CLIENT -> SERVER: --b1_4Px5PcyItpZIBJeyp03zA7sVd6uBkNPwuctLKMLeU4-- 2018-01-15 08:45:54 CLIENT -> SERVER: 2018-01-15 08:45:54 CLIENT -> SERVER: . 2018-01-15 08:45:55 SERVER -> CLIENT: 250 Ok 01000160f8ff15ea-af0d4268-6c9e-43ee-8bbb-4081917f75d6-000000 2018-01-15 08:45:55 CLIENT -> SERVER: QUIT 2018-01-15 08:45:55 SERVER -> CLIENT: 221 Bye Message has been sentroot@ok:~/ses-test# |
[…]
Zend OpCache Install Zend OpCache on OpenLiteSpeed Server PHP Script to Find GeoIP info Enable PHP Error Reporting Connect to redis from PHP PHP Script to List Enabled Extensions Run .htm files as PHP in Apache Disable PHP insecure functions with disable_functions PHP running system commands with exec Large file upload in PHP PHP script […]
Here is a PHP script to check if PHP Zend OpCache is enabled on your server. https://gist.github.com/HostOnNet/e3f36fe923d408b8597575d601114a88 You can use OpCache GUI to see detailed stats https://github.com/amnuts/opcache-gui Install Zend OpCache on OpenLiteSpeed Server See php […]
uppy Open Source upload progress bar. https://uppy.io […]
If you have PHP GeoIP module installed, you can use following PHP script to find GeoIP info.
1 2 3 4 5 6 7 8 9 |
<?php $ip = $_SERVER['REMOTE_ADDR']; echo '<pre>'; echo "\n\ngeoip_country_code_by_name\n\n"; print_r(geoip_country_code_by_name($ip)); echo "\n\ngeoip_record_by_name \n\n"; print_r(geoip_record_by_name ($ip)); |
[…]
To enable PHP error reporting in scripts, add
1 2 |
error_reporting(E_ALL); ini_set('display_errors', '1'); |
To avoid PHP scripts showing errors, add
1 2 |
error_reporting(0); ini_set('display_errors', '0'); |
See php […]
rvm is ruby version manager. Allow you to have multiple ruby version. To install rvm, run
1 2 |
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 curl -sSL https://get.rvm.io | bash -s stable |
To install a ruby version, run
1 |
rvm install 2.4.2 |
To set it default, use
1 |
rvm --default use 2.4.2 |
[…]