Set up an Amazon Ubuntu Ec2 instance with Mysql, PHP, Apache and PHPMyAdmin - on WINDOWS + CAKEPHP3
How Set up an Amazon Ubuntu Ec2 instance with Mysql, PHP, Apache and PHPMyAdmin, Curl for Paypal to use on Cakephp 3
Set up an Amazon Ubuntu Ec2 instance with Mysql, PHP, Apache and PHPMyAdmin - on WINDOWS + CAKEPHP3
For the first time user especially trying to setup and configure and amazon instance is daunting and can be quite confusing as
there are no clear step by step instructions to tell you how to. Amazon does cover a lot but not all. Once the Amazon Instance is configured we are going to configure Cakephp 3 aswell. Developed on a local xampp server. Questions are welcome
The first time I did this Ubuntu on Amazon used PHP5 the second time I did this it was upgraded to PHP7 I have inserted the settings for PHP7 which is slighly different.
So here is our step by step instructions tailored for the absolute beginning.
- Create and Amazon account,
- Click on 'Launch instance' select the type of instance you like, we select Ubuntu
- Once you have launched you instance, alter the security, the make the outbound available to all and also the INBOUND
- While launching the instance it will ask you to download the file with extention .pem
- Download and install download WINSCP which come bundled with Putty or just download putty on it's own
- Use Putty KeyGen and generate a private key to use when loggin into your instance - for testing I did not use the 'generate' option in the key gen but simply imported the PEM file and saved in to the PPK equivalent in keygen
- If you are not familiar with Putty, read a tutorial how to use it, once you have done it once it is easy. You need to use the private file you generated as a password to SSH you Amazon instance - techno speak for access you Amazon Cloud server.
- sudo apt-get update
- sudo apt-get dist-upgrade
- sudo apt-get install apache2
- sudo nano /etc/apache2/apache2.conf
- change var/www to AllowOverride All
- change user/var to AllowOverride All
- CTRL + X save
- sudo a2enmod rewrite
- sudo apt-get install libapache2-mod-php5
- sudo service apache2 restart
- View you in browser on your ip address
- Create a .htaccess file that point to index.php with phpinfo() in it. - for testing
- sudo apt-get install mysql-server l - remember your password
- sudo apt-get install php5-mysq FOR PHP7 (php -v) you need sudo apt-get install php7.0-fpm php7.0-mysql
- sudo apt-get install phpmyadmin
- sudo nano /etc/apache2/apache2.conf
- Go back insert the following 'Include /etc/phpmyadmin/apache.conf' (ctl + o = save)
- Installing cakephp 3 extentions sudo apt-get install php5-intl FOR PHP& sudo apt-get install php7.0-intl
- Fpr Paypal you need Curl --- sudo apt-get install php-curl
- sudo service apache2 restart
- show extentions: php -m
- sudo apt-get install php5-sqlite FOR PHP7 use sudo apt-get install php-sqlite3
- sudo service apache2 restart
- change permissions to tmp, logs and img folders recursivley
- If you stuggle with permissions in SSH make yourself root by sudo -i
- change file permissions like sudo chmod -R o+rw /var/www
- In PHP7 version I get a sql_mode=only_full_group_by error: to fix it I did:
sudo nano /etc/mysql/my.cnf
edit at bottom of file:
[mysqld] sql_mode = "STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
sudo service mysql restart
https://help.ubuntu.com/community/phpMyAdmin
http://archive.gregk.me/2011/installing-pdo-sqlite3-support-on-ubuntu/
Published: 25th January 2017 by Gabriel Kolbe