Wednesday, October 17, 2018

Solution To: Laravel Error No application encryption key has been specified.

.
PROBLEM:

RuntimeException
No application encryption key has been specified.

SOLUTION:


1. If .env does not exist in root folder, .env.example file in the root of your project to .env or create a new .env file.

2. You should not just create empty .env file, but fill it with content of .env.example.

.envfile look like this: (Fill up with required database connection)

APP_ENV=local
APP_DEBUG=true
APP_KEY=SomeRandomString
APP_URL=http://localhost

DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret

CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_DRIVER=smtp
MAIL_HOST=mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
.


3. In the terminal go to the project root directory(not public folder) and run

php artisan key:generate

If everything is okay, response in terminal should look like this
Application key [base64:wbvPP9pBOwifnwu84BeKAVzmwM4TLvcVFowLcPAi6nA=] set successfully.

4. Check that the Application Key is inserted into .env file.

You can just copy key itself and paste it in your .env file as the value to APP_KEY. Result line should looks like this:
APP_KEY=base64:wbvPP9pBOwifnwu84BeKAVzmwM4TLvcVFowLcPAi6nA=

5. In terminal run

php artisan config:cache

.
REFERENCE:
https://stackoverflow.com/questions/44839648/no-application-encryption-key-has-been-specified-new-laravel-app


Solution To: Laravel Error file_get_contents(/var/www/laravel/.env): failed to open stream

.
PROBLEM:

file_get_contents(/var/www/laravel/.env)
: failed to open stream
: No such file or directory”?

SOLUTION:
Probably you missed your .env file in laravel project folder.So make .env.example to .env file. Also give the required database connection.

.envfile look like this: (Fill up with required database connection)

APP_ENV=local
APP_DEBUG=true
APP_KEY=SomeRandomString
APP_URL=http://localhost

DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret

CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_DRIVER=smtp
MAIL_HOST=mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
.
REFERENCE:
https://stackoverflow.com/questions/36761778/how-to-resolve-the-error-errorexception-file-get-contents-var-www-laravel-e

Solution To: Laravel Error failed to open stream: Permission denied



PROBLEM:

Laravel Error failed to open stream: Permission denied

SOLUTION:

Most folders should be normal "755" and files, "644"

Laravel requires some folders to be writable for the web server user. You can use these command on *nix based OSs.

Using ACL

// nginx = web server user
// systemuser = your local user which you use to login via ssh
sudo setfacl -Rdm u:nginx:rwx,u:systemuser:rwx storage
sudo setfacl -Rm u:nginx:rwx,u:systemuser:rwx storage

Alternatively, if you don't have ACL

sudo chgrp -R www-data storage bootstrap/cache
sudo chmod -R ug+rwx storage bootstrap/cache


REFERENCE:
https://laracasts.com/discuss/channels/general-discussion/laravel-framework-file-permission-security
https://stackoverflow.com/questions/30639174/file-permissions-for-laravel-5-and-others

Solution To: Whoops, looks like something went wrong. Laravel 5.0

.
PROBLEM:

I installed Laravel 5.0 properly by cloning in git, and composer install, when I ran it to browser http://localhost/laravel/public/, it says

"Whoops, looks like something went wrong."


SOLUTION:

The error logs are located in storage directory. 

You need to check the error message in order to identify the cause of the error.

Solution To: Laravel 5 Failed opening required bootstrap/../vendor/autoload.php


PROBLEM:
Laravel 5 Failed opening required bootstrap/../vendor/autoload.php

SOLUTION:
...

When the new project created the laravel require to load vendors to autoload the libraries , We need to tell composer to update via command:

composer update

Composer is a dependency manager allows you to delegate responsibility for managing your dependencies to a third party.

In some cases, you need to tell composer to install first via ommand:

composer install 

If this does not solve the problem, make sure the following php modules are installed php-mbstring php-dom

To install this extensions run the following in terminal

sudo apt-get install php-mbstring php-dom

once the installation is complete

try running the command in your project root folder

composer install 

REFERENCE:
https://stackoverflow.com/questions/28468625/laravel-5-failed-opening-required-bootstrap-vendor-autoload-php


Solution To: CodeEnvy Laravel 5.6 which requires PHP 7.1.3 or higher, but the recipe installs PHP 7.0.


PROBLEM:
When you use the eclipse/php:laravel recipe, it installs Laravel 5.6 which requires PHP 7.1.3 or higher, but the recipe installs PHP 7.0.


SOLUTION:
The temporary solution is to manually install PHP 7.2:

sudo apt-get update
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get purge php7.0 php7.0-common
sudo apt-get install php7.2-curl php7.2-xml php7.2-zip php7.2-gd php7.2-mysql php7.2-mbstring

REFERENCE:
https://github.com/codenvy/codenvy/issues/2673

Wednesday, October 3, 2018

Getting Started With Eclipse Che, OpenShift, FuelPHP


.

Getting Started With Eclipse Che, OpenShift, FuelPHP

Eclipse Che is a developer workspace server and cloud IDE. You install, run, and manage Eclipse Che with with different container orchestration engine such as Docker or OpenShift.
Eclipse Che is available in two different modes:
  • Single-user: perfectly suited for personal desktop environment.
  • Multi-user: best for organization and developer teams.
If you want to learn more about the differences between single-user and multi-user, please read this page

OpenShift

Che supports different flavors of OpenShift:
If you want to try Che on OpenShift, we recommend you to do it with MiniShift and use the MiniShift add-on for Che.

1) Goto Che Website

If you haven’t got any acount, click the “Create a free account” button.

2) Go to Che Dashboard

If you have already got an OpenShift account, you will be redirected to https://che.openshift.io/dashboard 
.

3) Create A New Workspace

Enter workspace details.
E.g.
Name = my-php-workspace
Stack = PHP
Project = (none)
Plugins = (none)
Click Create button.

4) Create New Project

Since we did not specify any project in the previous step, we are required to do so now.

4.1) Select PHP Composer option.

4.2) Specify FuelPHP package

Package name= fuel/fuel

4.3) Wait until the process is completed.

It will take some time for the system to generate FuelPHP project based on composer package name.

5) Run Project

5.1) Run Apache

Find the run button.
Click and select Start Apache.

5.2) Browse the view URL

Find the view url in the console under the start apache tab.

6) Debug

The page may be having a problem when it is viewed in the browser e.g. mixed content request.
In the above example, the css content was requested via insecure connection.
We can enforce the FuelPHP to use a base url .
Edit ./fuel/app/config/config.php
'base_url'  => 'https://route3v3uiast-razicommy-che.9a6d.starter-us-east-1a.openshiftapps.com/phpcom/public/',
Mixed content error is solved now.
.

Monday, October 1, 2018

Install FuelPHP via Softaculous



You can have the FuelPHP framework installed in minutes by using the Softaculous application installer in cPanel.

To install FuelPHP using Softaculous, follow these steps:

1) Log in to cPanel.


In the SOFTACULOUS APPS INSTALLER section of the cPanel home screen, click any of the options under Categories. The Softaculous installer page appears.

It does not matter which option you click under Categories. All of them start the Softaculous installer.

In the Search text box, type fuelphp and then press ENTER.

Alternatively, you can use the navigation pane on the left side.  To do this, click Frameworks, and then click FuelPHP.

Click Install. The installation page appears.

2) In the Choose Protocol list box, select the protocol.


If you have an SSL certificate installed on your site, select https:// or https://www. If you do not have an SSL certificate installed on your site, select http:// or http://www.

3) In the Choose Domain list box, select the domain for installation, or accept the default value.


4) In the In Directory text box, type the directory where you want to install the application, or accept the default value.


If you want your domain name to go directly to the application, make sure the In Directory text box is blank.

5) Click the Advanced Options icon icon to expand Advanced Options.


If you do not want to receive e-mail notifications when application updates are available, select the Disable Update Notifications check box.

It is recommended that you receive e-mail notifications when application updates are available. Keeping your site updated helps prevent unauthorized access attempts and data loss.

6) To receive site configuration information after the installation is complete, type an e-mail address in the Email installation details to text box.


7) Review the installation options and settings, and then click Install. When installation is complete, Softaculous provides information about the application's configuration.


Labels