Magento 2.1 CE installed but front/back-end not loading - php

I am new to Magento and trying to install it myself but can't see it working after installing it successfully.
I followed Amazon instructions and installed PHP56, MySQL 5.7 & phpMyAdmin and then followed the following steps to install Magento 2.1 CE:
sudo su
vi /etc/php.ini
?always_populate_raw_post_data
I
always_populate_raw_post_data = -1
:wq
service httpd restart
sudo yum install php56-intl –y
service httpd restart
mkdir /var/www/html/magento2ce
upload magento tar file to /var/www/html/magento2ce and unzip using tar command
cd /var/www/html/magento2ce
tar zxf Magento-CE-2.1.1-2016-08-29-06-31-39.tar.gz
And before installation I used following command to assign permissions to magento folders:
cd /var/www/html/magento2ce && find var vendor pub/static pub/media app/etc -type f -exec chmod g+w {} \; && find var vendor pub/static pub/media app/etc -type d -exec chmod g+ws {} \; && chown -R :apache . && chmod u+x bin/magento
And after all that I stared Setup Wizard which ran successfully.
But nothing works when I try to access front/backend.
Can any one please let me what I am missing here?

After installing Magento 2, you need to run some commands through command line (cmd) in your root directory.
A) Upgrade command : php bin/magento setup:upgrade
B) Deploy command : php bin/magento setup:static-content:deploy en_US
If your store has multi-language then you need to mention all the language code during running deploy command.
For example : php bin/magento setup:static-content:deploy en_US, nl_NL, fr_FR
C) Reinxing command : php bin/magento indexer:reindex

Related

000-default.conf not found while building docker image of Laravel app on windows

I am trying to deploy my Laravel application on AWS using docker image by following given tutorial:
https://medium.com/#okekedesmond/deploying-containerized-laravel-application-using-aws-ec2-instances-with-docker-and-rds-883e8f6d6245
I am stuck at first point while building docker image. Here is my Dockerfile:
# Defining the base image for our project, if you understand how docker images and layers work, this should not be difficult to understand.
FROM php:7.3-cli
# We need to update the image and install some import packages
RUN apt-get update -y && apt-get install -y openssl zip unzip git curl libpng-dev libonig-dev libxml2-dev
# cleaning packages and install scripts
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
# Installing composer which is used to install Laravel
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin –filename=composer
#Creating a configuration file for apache and linking
ADD 000-default.conf /etc/apache2/sites-available/
RUN ln -sf /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-enabled/000-default.conf
#Restarting Apache
RUN a2enmod rewrite
RUN service apache2 restart
# Create a work directory and copy all project file into the
WORKDIR /var/www/app/
COPY . /var/www/app
#Granting permissions to files and folders
RUN chmod -R o+w /var/www/app/storage
RUN chown -R www-data:www-data ./storage
RUN chgrp -R www-data storage bootstrap/cache
RUN chmod -R ug+rwx storage bootstrap/cache
RUN chmod -R 755 /var/www/app/
RUN find /var/www/app/ -type d -exec chmod 775 {} \;
RUN chown -R www-data:www-data /var/www
# Installing dependencies from laravel package
RUN composer install --no-scripts --no-autoloader --no-ansi --no-interaction --working-dir=/var/www/app
#Running some packages
RUN docker-php-ext-install mbstring pdo pdo_mysql mbstring exif pcntl bcmath gd opcache
#Running Laravel on docker, because we are using the php-7.3-cli so we have to use a php server in our docker image
CMD php artisan serve --host=0.0.0.0 --port=80
EXPOSE 80`
It is giving error at step no. 5:
Step 5/21 : ADD 000-default.conf /etc/apache2/sites-available/
ADD failed: file not found in build context or excluded by .dockerignore: stat 000-default.conf: file does not exist
How do I solve it on windows? any help will be appreciated
I think the best solution is to manually make a new one, here is an example file:
https://gist.github.com/tjtoml/942d696c868b22a25259
And it should be located in:
/etc/apache2/sites-available/000-default.conf
It could be that you have to customize it for your needs

Composer install not executed by user data from AWS Launch Configuration

I have created an AWS Launch Configuration with following user data
#!/bin/bash
ssh-keyscan github.com >> ~/.ssh/known_hosts
git clone git#github.com:[MyUserName]/[project-name].git /var/www/[project-name]
cd /var/www/[project-name]
composer install --no-dev
php artisan migrate
chown -R www-data:www-data /var/www
chmod g+w -R /var/www
Now every line gets executed, except composer install --no-dev. But if I run the above script manually everything works fine. So can anyone please help me understand what is the problem. Thanks

How can I test that a docker wordpress-fpm with custom plugins works

I have made The following Dockerfile:
FROM wordpress:fpm
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update &&\
apt-get install -y unzip &&\
rm -rf /var/cache/apt/*
ENV PLUGIN_URL https://downloads.wordpress.org/plugin
ENV PIWIK_PLUGIN_VERSION 1.0.9
RUN curl -o /tmp/wp-piwik.${PIWIK_PLUGIN_VERSION}.zip ${PLUGIN_URL}/wp-piwik.${PIWIK_PLUGIN_VERSION}.zip &&\
unzip /tmp/wp-piwik.${PIWIK_PLUGIN_VERSION}.zip -d /tmp &&\
chown www-data:www-data /tmp/wp-piwik &&\
mv /tmp/wp-piwik /usr/src/wordpress/wp-content/plugins/&&\
find /usr/src/wordpress/wp-content/plugins/wp-piwik -type d -exec chmod 755 {} + &&\
find /usr/src/wordpress/wp-content/plugins/wp-piwik -type d -exec chmod 633 {} + &&\
ls -l /usr/src/wordpress/wp-content/plugins/
But as you can see it runs fpm. Also on my host have installed a lamp stack with php that does NOT run on fpm. So I want my installed apache to be able to connect to my a running fpm container from the above dockerfile.
What I want to achieve it to test that the plugin I installed manually during the build works like a charm.
In the end I switched this:
FROM wordpress:fpm
Into this:
FROM wordpress
So I can test directly with my browser via docker's port forwarding

Permission Issue in Docker container for Symfony2

I'm tring to create an Docker image to bootstrap Symfony project.
Here is my Dockerfile:
FROM php:7-apache
LABEL Description = "This image is used to start Symfony3 project"
ENV DIRPATH /var/www/html
# apt-get command
RUN apt-get update && apt-get install -y \
vim \
git
RUN apt-get install -y zlib1g-dev && docker-php-ext-install zip
# Install Composer
RUN curl -sS https://getcomposer.org/installer | php
RUN mv composer.phar /usr/local/bin/composer
# Install the Symfony Installer
RUN curl -LsS http://symfony.com/installer -o /usr/local/bin/symfony
RUN chmod a+x /usr/local/bin/symfony
# Create the php.ini file
RUN cp /usr/src/php/php.ini-development /usr/local/etc/php/php.ini
The build and the container creation works well but I have a permission issue in my container.
When I'm going to my app_dev.php, I have this message:
You are not allowed to access this file. Check app_dev.php for more information.
Apparently, I can access this file only with localhost.
Also, PHP can't delete or create anything in my container.
For exemple I have the following error when I'm running:
$php app/console cache:clear
Failed to remove directory "/var/www/html/app/cache/dev_old/doctrine
How can I solved that in my Dockerfile?
Finally found it after weeks:
Add that in you Dockerfile. It solved the permission issue.
# Workaround for write permission on write to MacOS X volumes
# See https://github.com/boot2docker/boot2docker/pull/534
RUN usermod -u 1000 www-data

phpunit and yii - (PHPUnit/Autoload.php): failed to open stream:

Having a lot of problems installing phpunit with Yii. I run:
$ phpunit unit/dbTest.php
But it turns out this error:
PHP Warning: require_once(PHPUnit/Autoload.php): failed to open stream: No such file or directory in /opt/yii-1.1.10.r3566/framework/test/CTestCase.php on line 12
(include_path='.:/usr/bin:/usr/share/php:/usr/bin/pear:/usr/share/php/Zend/:/opt/php5.3.10/lib/php/PHPUnit'
Some details about my installation:
$ phpunit --version
PHPUnit 3.4.5 by Sebastian Bergmann.
php --version
PHP 5.3.10 (cli) (built: Apr 6 2012 20:06:37) ( rebuilt didn't help :( )
pear list phpunit/phpunit
....
php /opt/php5.3.10/lib/php/PHPUnit/Autoload.php
According to that info, autoload is installed, and is on the include path.
I'm unsure what else I need to do - can anyone shed a light please?
I hope this is of some use to someone:
It seems on ubuntu PEAR is broken for this task and apt-get won't help either.
This is how i solved it
Manually download from http://pear.phpunit.de/
phpunit/PHPUnit
and
phpunit/File_Iterator
PHPUnit_MockObject
phpunit/PHPUnit_Selenium
PHP_CodeCoverage
Manually dezip and put correctly in php lib or wherever you want them to go. Put the head of this library on your include path (PHP, PHPlib, PEAR are all at this root level on my setup.)
Goddam, hope that helps someone i spent about 6 hours getting this to work last nite...
As rix shows in his answer, you have to download some files manually.
I got it working on Ubuntu 10.04 following these commands:
wget http://pear.phpunit.de/get/PHPUnit-3.6.10.tgz
wget http://pear.phpunit.de/get/File_Iterator-1.3.1.tgz
wget http://pear.phpunit.de/get/PHPUnit_MockObject-1.1.1.tgz
wget http://pear.phpunit.de/get/PHPUnit_Selenium-1.2.6.tgz
wget http://pear.phpunit.de/get/PHP_CodeCoverage-1.1.2.tgz
wget http://pear.phpunit.de/get/PHP_TokenStream-1.1.3.tgz
wget http://pear.phpunit.de/get/Text_Template-1.1.1.tgz
wget http://pear.phpunit.de/get/PHP_Timer-1.0.2.tgz
sudo vi /etc/php5/cli/php.ini
=> add /usr/share/php/PHPUnit/ to include_path directive
tar xzf PHPUnit-3.6.10.tgz
cd PHPUnit-3.6.10/
sudo cp -r PHPUnit/ /usr/share/php/
sudo ln -s /usr/share/php/PHPUnit /usr/bin/PHPUnit
tar xzf File_Iterator-1.3.1.tgz
sudo cp -r File/ /usr/share/php/PHPUnit/
tar xzf PHP_CodeCoverage-1.1.2.tgz
cd PHP_CodeCoverage-1.1.2/
sudo cp -R PHP/ /usr/share/php/PHPUnit/
tar xzf PHP_TokenStream-1.1.3.tgz
cd PHP_TokenStream-1.1.3/PHP/
sudo cp -r Token* /usr/share/php/PHPUnit/PHP/
tar xzf Text_Template-1.1.1.tgz
cd Text_Template-1.1.1/
sudo cp -r Text/ /usr/share/php/PHPUnit/
tar xzf PHP_Timer-1.0.2.tgz
cd PHP_Timer-1.0.2/
sudo cp -r PHP/Timer* /usr/share/php/PHPUnit/PHP/
tar xzf PHPUnit_MockObject-1.1.1.tgz
cd PHPUnit_MockObject-1.1.1/
sudo cp -r PHPUnit/Framework/MockObject/ /usr/share/php/PHPUnit/Framework/
tar xzf PHPUnit_Selenium-1.2.6.tgz
cd PHPUnit_Selenium-1.2.6/
sudo cp -r PHPUnit/Extensions/* /usr/share/php/PHPUnit/Extensions/

Categories