Inspired by Laravel, bugged by file permission

Before it worked and the light came up, It was first like a darkside to troubleshoot, I had to change ownership of the new Laravel project to :www-data with

# chown -R :www-data /var/www/html/player/

This was done after I had used:

# chmod -R 775 /var/html/player/storage/*

And:

# chmod -R 775 /var/html/player/vendor/*

If I had earlier stumbled upon this exact configuration in the Laravel 5.0 documentation where this is written (even though I was working with 5.2), I would have saved a lot of time and not (learn the hard way) to check the simplest of information.

Laravel may require some permissions to be configured: folders within storage and vendorrequire write access by the web server.

I was although able to finally hit the nail on the head to break the deadlock when I navigated through some Stackoverflow‘s questions and answers searching the above sentence on Google, but was able to find it here and just at the end of this.
Okay, not to give the scenario of what happened, what I faced and how I was able to get it done:

The /player directory is the directory where the Laravel boilerplate and directives are for the music player project idea I conceived and since I just began with Laravel, I find it interesting to never do a normal php project again therefore, I chose to do it again. What am I doing again? It is to create a new Laravel project.

Having gone through the rigor of getting out of my comfort zone of writing php without frameworks, I realize I could have learnt a lot of things and made my development life easier and fantastic with using a good framework like Laravel (even though I had a taste of this with Ruby on Rails). Much has been said about this framework already by friends and so I decided to try it out.

To cut the story short, I managed to get my first Laravel project running which I named blog because I was following the courses Introduction to Laravel 5.2 from a Udemy tutorial I found on Youtube. Now it was time to unleash the beast and simply make my office period more interesting with my own personalized and customized music player after I had followed the Laravel 5.2 documentation to install using Composer and had created an Apache configuration file as well, then to access my new http://player.mine URL became a bit of work. What here did I do wrong?

Even though I had done an update with composer update and had set my configuration for Apache to use my Laravel’s project /public directory, yet it would not work. The next thing I tried was setting the same server name in my /etc/hosts file with:

127.0.0.1 localhost
127.0.0.1 player.mine

This resulted in a blank page (testing on Mozilla Firefox). Even though I checked if there were errors in my Apache configuration and also ensure I enabled with a2ensite player.conf yet It was to no avail. The major mistake I did was to not check the log. I came to my senses then checked Apache’s error log: there I found this error being thrown the last times I had loaded the page:

 

HP Fatal error:  Uncaught exception 'UnexpectedValueException' with message 'The stream or file "/var/www/html/player/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied' in /var/www/html/player/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:107\nStack trace:\n#0 /var/www/html/player/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php(37): Monolog\\Handler\\StreamHandler->write(Array)\n#1 /var/www/html/player/vendor/monolog/monolog/src/Monolog/Logger.php(336): Monolog\\Handler\\AbstractProcessingHandler->handle(Array)\n#2 /var/www/html/player/vendor/monolog/monolog/src/Monolog/Logger.php(615): Monolog\\Logger->addRecord(400, Object(UnexpectedValueException), Array)\n#3 /var/www/html/player/vendor/laravel/framework/src/Illuminate/Log/Writer.php(202): Monolog\\Logger->error(Object(UnexpectedValueException), Array)\n#4 /var/www/html/player/vendor/laravel/framework/src/Illuminate/Log/Writer.php(113): Illuminate\\Log\\Writer->writeLog('error', Object(UnexpectedValueException in /var/www/html/player/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php on line 107

So I realized that the issue was file permission for the Laravel project.

I wouldn’t say this is the perfect solution to this issue because I have seen some other several suggestions of how it could be fixed but by this experience it is most likely one of it. If you have any supposed better way out you can help suggest in the the comment.

Thanks for reading 🙂

This is #tobisoft #omisakinoluwatobisamuel

 

 

Advertisements

Inspiring first Codeception API test

How inspiring indeed can testing Web services be…

I started this journey to begin with, Codeception php testing framework. First of all I would conclude before I go on to share my experience that this is one of the best testing framework around now – you can talk about the simplicity and versatility it ensures, and easy integration with other PHP frameworks (Laravel e.t.c) and using different web drivers (Selenium etc) almost seamlessly.

My own tale of this adventure started when I had to use it on PHP 5.3.3. Yes, it was succesfully installed using:

codecept_install1

Of course strangely it got installed and it was time to try out some example at first from Codeception Web Services testing docs. If the whole system was configured properly and the installation goes as expected then simply writing:


codeception

Expectantly, there was no error response, after a further trial to no good signal to tell whether it works or not, I got to know that the installed version of Codeception was higher version and so the 1.8.7 version was later installed, and now this seems to look good, however this is where the adventure starts. Continue reading “Inspiring first Codeception API test”

Inspired by doubt, trailing Vormsi’s hack!

No one actually could explain it better than I could.

After enduring a long week of decision trouble and toggle to go for the (Garage48’s e-Residency) hackathon or not; At the night of Thursday, I finalized the decision. Assignments were quite huge, and tiredness grew to the face, but the most dreaded challenger of my decision to go was fear, although I had a bible study, a birthday, and a church service to attend before Monday morning. Fear of WHAT ON EARTH DO I KNOW? But at last I summoned courage Continue reading “Inspired by doubt, trailing Vormsi’s hack!”

Independent Estonia, Inspiring Estonia.

happy independence day

It was such a day to really witness, Estonia’s national day. I decided though to dedicate this blog and the entire post to my professional career path, although I must come up with exciting series about my steps and paths to my great vision.

It may be somehow funny I came up with this post way far from the Independence day but right even before that: 24th February, 2016, the day the Estonians calls Eesti Vabariigi aastapäev (Wikipedia), my mind had been like an empty bottle unstable on the water – panting after the day I would paint this blog with my writing about Continue reading “Independent Estonia, Inspiring Estonia.”

By Inspiration, to Reality.

Hey,

This is Omisakin Oluwatobi Samuel. I will be making the blog a channel for conveying my ideas and experience in my career and chosen field (of Software developing). I will try to make post on various topics as much as I have laid hands on or I am anticipating.

I will check from different software development and programming language. Projects developments, and some key specific area as I have gone through starting from my personal research to my academics.

I will also as well tell about my experiences in different environments and some discovery I have, and would still make.

I will also be unveiling some thoughts about key aspects of life generally. The lesson learnt, and most especially my reflections about them.

I hope someone would find my work reasonable and useful for them one way or the other. And most importantly, a more experienced reader would find it exciting and to leave their replies to help me get a good grip in my career path as others as well gain from it.

“Despite not the days of humble beginnings…”

This is Tobisoft blog. #tobisoft #omisakinoluwatobisamuel