George McKinney Adventures in Software Development

November 8, 2022

Sending Mail from AWS Lightsail using WP MAIL SMTP by Shared Hosting (Mochahost!)

Filed under: AWS,Lightsail,Mochahost,PHP,WordPress — georgemck @ 9:21 pm

AWS Lightsail enables Amazon Web Services customers to host “simple web applications, use pre-configured development stacks like LAMP, Nginx, MEAN, and Node.js.” This includes WordPress-powered websites. Lightsail creates a Debian-based virtual server to host these applications allowing SSH connections. Unfortunately, unlike traditional shared hosting services,  mail functionality is not included. This prevents WordPress from sending emails normally including for password resets. Fortunately, there is an easy to use plugin (WP MAIL SMTP) that provides a number of options for sending email including  SendLayer, SMTP.com, Sendinblue, Mailgun, SendGrid, Postmark, SparkPost, Gmail, Microsoft, Amazon SES, Zoho, and All Other SMTP providers.

Since web services do not need to be provided by the same server address or even the same company. It is possible to split web application hosting from mail server hosting via customizing the DNS zone settings (That topic is not addressed here). The goal of this post is to point out the settings necessary to enable the Lightsail application to use mail settings from one of the “All Other SMTP” providers, specifically Mochahost.

First off, you must create an email account on Mochahost. By doing so, you will immediately know the username and password. The configuration for setting up a mail client are available. However, instead of using the website’s domain it is necessary to use the mail server domain in this case, mochaXXXX.mochahost.com. The port will be 587. Encryption will be TLS. Finally, authentication with username and password are required.

Here is an example of the WP MAIL SMTP plugin settings:

 

 

Now, send a test email:

 

And check your email:

 

All these companies provide great servers and, when you need to scale, you will be in good hands.

 

 

July 20, 2021

Upgrading to PHP 7.2 on Amazon Linux

Filed under: AWS,CIS 192,PHP — georgemck @ 10:24 pm

#Upgrading to PHP 7.2 on Amazon Linux

#check current version of PHP
php -v

#stop APACHE and PHP services
sudo service httpd stop

#uninstall APACHE and PHP
sudo yum remove httpd* php*

#Get latest updates
sudo yum update -y

#install PHP 7.2
sudo yum install php72

#install MySQL driver for PHP 7.2
sudo yum install php72-mysqlnd

#Start APACHE web server
sudo service httpd start

#cleanup
sudo yum clean all

November 30, 2020

Disabling Zend OPcache

Filed under: Laminas,PHP,Zend Framework — georgemck @ 8:14 am

I ran across the need to disable Zend OPcache when working with Laminas API Tools in PHP, which was formerly called Zend Framework’s APIgility. In addition to requiring PHP Unit, you have to disable Zend OPcache to create a working API. Zend OPcache is bundled with many PHP installations to improve performance. In development on our local computers, we need to turn this off if we want this tool to work!

On your running server, figure out if it is on. You can see this in phpinfo() command. Create file name phpinfo.php and make sure it has correct permissions to run
<?php
phpinfo();
?>
Start your Development Server with built-in PHP server on Port 8080. Then retrieving the php settings information, phpinfo.php. Do not put this information on production server!
php server started view phpinfo
Here, the phpinfo() command shows the loaded configuration file location. /etc/php/7.4/cli/php.ini
phpinfo loaded showing php.ini file
Zend OPcache is enabled.
phpinfo shows zend opcache is ON in localhost

Check the php.ini. It looks off, but obviously it is actually enabled.

phpinfo zend opcache is ON in code editor
Disabling the Zend OPcache in the php.ini configuration file.  If the setting is on, then open the php.ini file and add
[opcache]
; Determines if Zend OPCache is enabled
;opcache.enable=1
opcache.enable=0
turning zend opcache OFF using code editor
Then restart your server application which created the website. This could be apache2, php -S, or apache monitor, whatever.
php server started view phpinfo
Zend OPcache has now been disabled
phpinfo showing zend opcache is OFF in localhost
Enjoy.
###
NOTE ABOUT OPCACHE from Laminas API Tools page

Disable all opcode caches when running the admin!

The admin cannot and will not run correctly when an opcode cache, such as APC or OpCache, is enabled. API Tools does not use a database to store configuration; instead, it uses PHP configuration files. Opcode caches will cache these files on first load, leading to inconsistencies as you write to them, and will typically lead to a state where the admin API and code become unusable.

The admin is a development tool, and intended for use a development environment. As such, you should likely disable opcode caching, regardless.

When you are ready to deploy your API to production, however, you can disable development mode, thus disabling the admin interface, and safely run an opcode cache again. Doing so is recommended for production due to the tremendous performance benefits opcode caches provide.

May 11, 2010

LogicalPick

Filed under: Flex,GAIA,OSCommerce,PHP,WordPress — georgemck @ 9:15 am

Awesome website using Flex 3 Framework, GAIA Framework, WordPress, and OSCommerce with e-commerce integration through First Data.

LogicalPick.com
Quick Pick
Free Pick of the Day

 

August 11, 2009

Hookstream

Filed under: Flex,Papervision,PHP — georgemck @ 9:36 pm

Hookstream Interactive was built using Flex Builder 3. The portfolio tab has a Papervision 3D carousel. Also, uses the canvas, video, and button bar.

Hookstream.com

 

Powered by WordPress