Amazon EC2 - PHP GD image library - wordpress

I've got a brand new install of WordPress setup and activated a custom-built theme along with a good amount of plugins. In the posts, I have built it so the user can create a post, upload an image as a thumbnail and it will automatically resize the image to a custom size set in my functions.php file.
All this has been working on my local end (MAMP) correctly but when I tried making everything work on our Amazon EC2 server, the images do not resize to the size set. They resize by actual code but do not resize the actual image and save it in the new size.
Apologies if the question/subject is completely non-sense but I have little to no experience with Amazon EC2 servers and I have been placed into a situation where the person in charge of all the work within EC2 had to leave the project.
I'm assuming that this has to do with the GD library not being installed.. I created a test page with phpinfo() and didn't see a GD area on the results page.
How would I go about installing the library on my Amazon EC2 server? I just learned how to connect to the server via Terminal and that's all I've got for now.. so you get an idea of how much I know about the subject.

I'm guessing you have some type of Linux installed, probably Ubuntu or CentOS.
Ubuntu: sudo apt-get install php5-gd
CentOS: sudo yum install php-gd
You probably have to restart Apache afterwards: service httpd restart or service apache2 restart -- the names differ from distribution to distribution.
Let me know if this works!

In my case, I was getting error like there is version conflict between different versions of php-common when I entered "yum install php-gd" so I checked my php version using "php -v" in shell and then installed the corresponding gd using "yum install php56-gd" because I had php 5.6 installed in my machine.
Hope someone will get help from this.
Cheers

to avoid compatibility problems first do:
php --version
to know your php version
the answer is something in the form PHP X.Y.Z
so you have to take X, Y and do:
sudo yum install phpXY-gd
for instance if php --version says PHP 5.5.26
you will do:
sudo yum install php55-gd

In my case of ec2 server running Amazon Linux 2 with php version 7.2.24, following was the sequence:
sudo yum install php-gd
But event after repeat server restart with
sudo systemctl restart httpd
it was not working unless I rebooted with
sudo reboot

In Amazon Linux, we have to add the following line to the etc/php.ini file
extension=gd.so
Step 1: Install the package using following command
sudo yum install php-gd
Step 2: Include the following line to the etc/php.ini file
extension=gd.so
If the line is commented, then uncomment it.
Step 3: Restart the httpd service
sudo service httpd restart

Related

Is Passenger Deprecated for Nginx versions above 1.14?

I updated nginx from version 1.14 to 1.18 (Ubuntu) on Ubuntu 18.04.
Doing so appeared to break passenger. So I uninstalled and attempted to reinstall the Open Source Passenger version via the Passenger installation Ubuntu 18.04 instructions.
I got to this line:
sudo apt-get install -y libnginx-mod-http-passenger
Which throws this error
libnginx-mod-http-passenger : Depends: nginx-common (< 1.14.1) but 1.18.0-3ubuntu1+bionic1 is to be installed
Update I also attempted with the enterprise version. Following the enterprise version installation instructions, I received a similar error message:
libnginx-mod-http-passenger-enterprise : Depends: nginx-common (< 1.14.1) but 1.18.0-3ubuntu1+bionic1 is to be installed
I did attempt to research the issue and I found this issue on Phusion's GitHub as well as this more recent issue. It appears that what most people are doing is rolling back their nginx version to 1.14.
It is not deprecated, no. The problem is that the packaged module you are trying to install was made for an older Nginx version that is distributed through the system default repository. This appears in the installation guide that you've mentioned:
At this point we assume that you already have Nginx installed from your system repository.
What this means is that the following instructions assume that you have Nginx specific version (1.14.0 in your case) installed, for which the packaged module was built. This is emphasised in the new passenger documentation:
If you want to use our packaged Nginx module, you must use your distro's provided Nginx package. If for example you have the repo provided by NGINX setup, you will instead need to compile a dynamic module compatible with that Nginx.
The link in the last quote will bring you to the guide on how to compile a dynamic passenger module and enable it in Nginx configuration. I will not repeat the whole process to keep the answer short but the general approach is this:
Get passenger module for Nginx source code.
Get Nginx source code for the version you have installed.
Compile Nginx with the passenger module:
cd /path-to-nginx-source-dir
./configure --prefix=/opt/nginx \
--with-some-configure-flag \
--add-dynamic-module=$(passenger-config --nginx-addon-dir) \
--add-module=/path-to-some-other-nginx-module
make
sudo make install
Make Nginx to load the module by adding this line to nginx.conf:
load_module modules/ngx_http_passenger_module.so;
Personally, I'd rather chosen the 'nginx-behind-nginx' approach than building the module. That is you have Nginx any version you like but it runs as a reverse proxy for another Nginx with passenger enabled (Passenger Standalone). With an unnoticeable penalty to performance this will be much easier to maintain (install, update). See this guide for details.

Ambari Server on Ubuntu 18.04: Response 403 while pulling Apache Ambari repository

I'm a newbie to Ubuntu. Now I'm trying to install Apache Ambari Server on Ubuntu 18.04.
I've successfully completed steps like installing jdk, turning off firewall, stopping SELinux. However I came up against an error when running the command to pull Apache repo. The command is:
$ wget -O /etc/apt/sources.list.d/ambari.list http://public-repo-1.hortonworks.com/ambari/ubuntu18/2.x/updates/2.7.5.0/ambari.list
The error was some HTTP response failure with code 403: Forbidden. I also try another version for ambari (like 2.6.2.0) and even different link for the repo but still the error happened.
So anyone could tell me what is the problem and how to fix it? Thanks so much for helping me out!
I am trying to install ambari on CentOs. I found out that one of the providers cloudera has stopped freely offering the ambari installation starting from this year. You can take a look here. P.S. hortonworks should be under cloudera so that might be the reason why you cannot download the public image.
One of the solutions would be to follow the guide from Apache Ambari official website, which is over here. You can follow the installation guide there for your desired Ambari version on Ubuntu.
For example, if you are going to install Apache Ambari with version 2.7.5, you will find this page useful.
Below is based on my understanding and the instructions described on the documentation but I have not try it yet since my working environment is on CentOS.
Take installation on Ubuntu for instance
Step 1: Install the prerequisites
According to this answer, at least you might need to install python, node and npm on your machine.
Step 2: Build the project using maven
# download ambari
wget https://www-eu.apache.org/dist/ambari/ambari-2.7.5/apache-ambari-2.7.5-src.tar.gz (use the suggested mirror from above)
tar xfvz apache-ambari-2.7.5-src.tar.gz
cd apache-ambari-2.7.5-src
mvn versions:set -DnewVersion=2.7.5.0.0
pushd ambari-metrics
mvn versions:set -DnewVersion=2.7.5.0.0
popd
# build ambari
mvn -B clean install jdeb:jdeb -DnewVersion=2.7.5.0.0 -DbuildNumber=5895e4ed6b30a2da8a90fee2403b6cab91d19972 -DskipTests -Dpython.ver="python >= 2.6"
Step 3: Install Ambari Server
apt-get install ./ambari-server*.deb
Step 4: Setup and Start Ambari Server
# setup your server
ambari-server setup
# start your server
ambari-server start
Step 5: Install and Start Ambari Agent on All Hosts
Note: This step needs to be run on all hosts that will be managed by Ambari.
apt-get install ./ambari-agent*.deb
Edit /etc/ambari-agent/ambari.ini
...
[server]
hostname=localhost
...
Make sure hostname under the [server] section points to the actual Ambari Server host, rather than "localhost".
# start ambari agent
ambari-agent start

Centos6 PHP7 Install SPL_Types

I am running CentOS 6 and am trying to install the SPL_Types extension for PHP7. I have php7 up and running however, any time I do pecl install SPL_Types,
I get massive compiler errors and can't find a way around. Ubuntu users can fix the issue by installing libpcre3-dev, but this is not a valid package on CentOS 6. I have verified that pcre and pcre-devel are installed and the latest version. Does anyone have a solution to this?
EDIT 1: A full log when I run the sudo pecl install SPL_Types command: http://pastebin.com/QG3mFjaf
I got it figured out. For those who wish to know, I had to use a third party source to compile and install the extension, then I had to edit my php.ini file manually to add the new module.
https://github.com/esminis/php_pecl_spl_types
then once you have it, run the commands:
phpize --clean
phpize
chmod +x configure
./configure --prefix=/usr
make install
Then, edit your php.ini file and under the dynamic modules section, add
extension=spl_types.so
Restart the httpd service by doing
sudo service httpd restart
Then verify the new module is loaded with phpinfo().

Migrate a self-hosted wordpress to MS Azure. Max query threshold exceeded with ClearDB

I would like to migrate a self-hosted wordpress site to Microsoft Azure. I've already done this migration job with Duplicator plugin from a server to another and everything worked well.
The problem with Ms Azure is that it uses a service called ClearDB to manage databases. (feel free to correct me if it's wrong) When you create a free account with this service you will get a restricted plan called Mercury which allows you to query your db (max dimension of 20MB) up to 3600 queries/hour.
But the migration process requires several operations on the database and the
As written in this blog the only option is to upgrade your plan to the 10$/month subscription.
I've found another way but the plugin the author uses in this link does not work for me.
Should I use another plugin to backup my WP content?
Do you have any advice?
Thanks
There are three solutions. I chose the first one.
Configure Mysql on a virtual machine and install Wordpress (classic way)
This can be done installing an already configured image with the Lamp packages on your Virtual Machine. Please see this link
If you want to set up it manually, follow these steps:
Create the vm (I used Ubuntu 14.04) then connect via SSH to your server.
ssh root#server_ip_address
Install Apache
sudo apt-get update
sudo apt-get install apache2
To check if Apache is installed, direct your browser to your server’s IP address. The page should display the words “It works!"
Install MySQL
sudo apt-get install mysql-server libapache2-mod-auth-mysql php5-mysql
During the installation, MySQL will ask you to set a root password. Once you have installed MySQL activate it with this command:
sudo mysql_install_db
Finish up by running the MySQL set up script:
sudo /usr/bin/mysql_secure_installation
The prompt will ask you for your current root password.
Install PHP
sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt
PHP also has a variety of useful libraries and modules that you can add onto your virtual machine. You can see the libraries that are available.
apt-cache search php5-
Decide which module you wish to install and type:
sudo apt-get install name_of_the_module
Although LAMP is installed, we can still take a look and see the components online by creating a quick php info page. Create a new file:
sudo nano /var/www/info.php
Add in the following line. Save and exit
<?php
phpinfo();
?>
Finally restart apache
sudo service apache2 restart
and check the info page typing in your url
server_ip_address/info.php
Install mysql in a VM and create an Azure Website with a Wordpress image. Then link the mysql db on the virtual machine to the Wordpress site.
Upgrade ClearDB plan to the 10$/month subscription and specify the url of your remote db in wp-config.php

amazon ec2 micro RHEL: how to install nginx or others?

I chose micro free RHEL6.4 instance with EC2/Amazon, when I login, I found there no gcc, which I can yum install it. and there no nginx to yum install ?
I must install gcc and develop tools and download nginx source code to install ? oh ,the free is only 30Gb one month?
Check the installation page inside nginx website

Resources