Skillbooker
Login Register

Cakephp


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.

  1. Create and Amazon account, 
  2. Click on 'Launch instance' select the type of instance you like, we select Ubuntu
  3. Once you have launched you instance, alter the security, the make the outbound available to all and also the INBOUND
  4. While launching the instance it will ask you to download the file with extention .pem
  5. Download and install download WINSCP which come bundled with Putty or just download putty on it's own
  6. 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
  7. 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.
  8. sudo apt-get update
  9. sudo apt-get dist-upgrade
  10. sudo apt-get install apache2
  11. sudo nano /etc/apache2/apache2.conf
  12. change var/www to AllowOverride All 
  13. change user/var to AllowOverride All 
  14. CTRL + X save
  15. sudo a2enmod rewrite
  16. sudo apt-get install libapache2-mod-php5
  17. sudo service apache2 restart
  18. View you in browser on your ip address
  19. Create a .htaccess file that point to index.php with phpinfo() in it. - for testing
  20. sudo apt-get install mysql-server l - remember your password
  21. sudo apt-get install php5-mysq FOR PHP7 (php -v) you need sudo apt-get install php7.0-fpm php7.0-mysql
  22. sudo apt-get install phpmyadmin
  23. sudo nano /etc/apache2/apache2.conf
  24. Go back insert the following 'Include /etc/phpmyadmin/apache.conf' (ctl + o = save)
  25. Installing cakephp 3 extentions  sudo apt-get install php5-intl FOR PHP& sudo apt-get install php7.0-intl
  26. Fpr Paypal you need Curl --- sudo apt-get install php-curl
  27. sudo service apache2 restart
  28. show extentions: php -m
  29. sudo apt-get install php5-sqlite FOR PHP7 use sudo apt-get install php-sqlite3
  30. sudo service apache2 restart
  31. change permissions to tmp, logs and img folders recursivley
  32. If you stuggle with permissions in SSH make yourself root by sudo -i
  33. change file permissions like sudo chmod -R o+rw /var/www
  34. In PHP7 version I get a sql_mode=only_full_group_by error: to fix it I did:
  35. sudo nano /etc/mysql/my.cnf
  36. 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/

 


Gabriel Kolbe
Posted on: 2017-01-25 Please login/register to leave comments