Laravel 5.0 - Error by running composer install - php

On Ubuntu, when I clone my Laravel 5.0 project from GitHub and then hit "composer install", I get the following result:
I can't see the .env file, but I tried copying .env file from other local project and then I get one error loading blade files using #include():
I tried on Windows too, but is the same result, I notice when I do "git add --all" a warnning message is showed:

I solved the problem, when I run "chmod -R 775 project_name", I had some views errors like:
I fixed the problem changing view path from this "tickets\partials\status" to "tickets/partials/status". I never thought that was the problem, because on Windows run right with this: "tickets\partials\status".

Related

Laravel 5.6 Upgrade caused Logging to break

Heey!
So I've recently been given the task to take a Laravel 5.2 up to 5.6. It seemed to be fine...until I tried to do a \Log::info(). Every time I run that, I get a big error, but at the end, it still prints to the log. I saw the 5.6 documentation on creating the config/logger.php. I took a fresh copy of it from github. The only thing I did after that was set an env variable for the LOG_CHANNEL to be single. Here's the error I get:
[2018-03-02 08:28:59] laravel.EMERGENCY: Unable to create configured logger. Using emergency logger. {"exception":"[object] (InvalidArgumentException(code: 0): Log [] is not defined. at I:\xampp\htdocs\mtm\vendor\laravel\framework\src\Illuminate\Log\LogManager.php:181)
[ ....
I did a file comparison between Laravel 5.2 and 5.6. I'm not seeing anything that jumps out that would break the Logging functionality.
Has anyone run into this with a Laravel upgrade?
Add this file to your config folder
https://github.com/laravel/laravel/blob/5.6/config/logging.php
and add this to your .env file LOG_CHANNEL=stack
Don't forget to run php artisan config:clear command afterwards.
I was facing the same issue due to upgrade of my laravel version from 5.3 to 5.7. But after search of few mints i found the solution.
You just need to follow the following steps.
create logging.php file inside the config folder.
Copy code from this Official Link of Laravel.
Past this code into your logging.php file.
run this command -- php artisan config:clear
All done. Happy Coding :)
I got the same problem and tried to do everything as you did but not work.
Finally, I've found that it was because of cached config, just clear it and everything will be fine:
php artisan config:clear
I recently had the same error in my development machine (and not in the production one, oddly). In my development machine I have both php 7.1 and php 7.2 installed. Checking with phpinfo(), I discovered that 7.1 was the default version, so I decided to switch to 7.2.
sudo a2dismod php7.1
sudo a2enmod php7.2
sudo systemctl restart apache2
That didn't solve the problem (but maybe was part of it).
After several hours spent on trying everything suggested around the web, I found my solution by:
Checking all the permissions in the storage folder.
In my project folder, clearing all the cache(s) and config(s).
Dumping all composer autoload files.
In detail:
cd your_project_full_path
sudo chmod -R 0775 storage
sudo chown -R www-data:www-data storage
php artisan config:clear
php artisan view:clear
php artisan route:clear
composer dump-autoload
After this, I had no problem any more. Maybe try 0755 as permission for the storage folder. Hope this helps!
use upgrade guide , and add logging.php to your config files.
After two days of some research, I found a solution on Github.
If you are using Laravel 5.5.4 to Laravel 5.6.*, then you can just install and configure the exceptions package by Graham Campbell.
Link: https://github.com/GrahamCampbell/Laravel-Exceptions
This worked perfectly for me on Mac OSX (PHP 7.1.7), Laravel 5.6.22
My initial error:
2018-05-25 14:35:07] laravel.EMERGENCY: Unable to create configured logger.
Using emergency logger. {"exception":"[object] (InvalidArgumentException(code: 0): Log [] is not defined. at /Users/pro/Sites/metiwave/vendor/laravel/framework/src/Illuminate/Log/LogManager.php:181)
In my case, APP_LOG= was blank in .env file so I saved it as APP_LOG=single and it worked.
I had the same issue, turns out I had accidentally moved the config folder. If you find yourself in the same situation, (probably as embarrassed as I am) move it back to the root folder of your project.
Regards
all right, i got it
take a look at the official library, copy log config configuration code :
link :https://github.com/laravel/laravel/blob/5.6/config/logging.php
create in your project's config directory logging.php file
copy the code in
clear the cache :php artisan config:clear
that's it. keep stomping ...

Trying to import and run a laravel project

I'm desperatly trying to run a friend's laravel program on my PC.
I can run the default Laravel webpage.
I copy and paste the project directory and run composer update or composer install in cmd prompt. Everything here seems to work fine
Then when i try to run this URL http://127.0.0.1/myproject/public/, this error shows:
I already tried to reinstall composer but it doesn't change anything.
Any ideas ?
Edit:
if i run php artisan dump-autoload:
Ensure that you set 777 permission to "storage" and "bootstrap/cache" folders:
There might be some problem in composer.json file. Try to manually check composer. json file and find out which dependency is causing the problem. Also you can try deleting composer.lock file and vendor directory and then running composer install.

bash: laravel: command not found

I am Using my own Machine Kali Linux 2.0 Debian x64 . Now, i have Installed Laravel in my directory structure like
/opt/lampp/htdocs/learning-larvel/
Inside the Learning-laravel folder i have Installed my Laravel files, and also i installed composer. So when i go to http://127.0.0.1/learning-laravel/public . I see a See a White Screen and in Between it is written "Laravel 5", which means the Laravel GUI Setup is fine.
Now, to create a new file for Laravel, when i open my Terminal and type
laravel new xyz
then it gives me a error which says bash: laravel: command not found
Now, how can i fix the error.. I have researched about it by setting PATH to bashrc. But i am not getting it fixed right. Additionally when i type in my command composer -version then also it says bash: composer: command not found but i have Installed composer on the folder learning-laravel itself.
I could also see files like composer.phar there in /opt/lampp/htdocs/learning-larvel/
Any help would be extremely thankful.
As the composer official getting started page points out:
There are in short, two ways to install Composer. Locally as part of
your project, or globally as a system wide executable.
if you wanna do composer -- or laravel -- in command line, you wanna install them globally.
Check out the following links:
https://getcomposer.org/doc/00-intro.md#installation-linux-unix-osx
https://laravel.com/docs/4.2#install-laravel
I encountered the same problem. Apparently, the composer exists in path ~/.config/composer/vendor/bin when running as super user. Therefore, replacing the paths which were described above by this, and it should work. Hope it helps.

Laravel - Artisan not working

I'm aware of the other questions out there, but they are different to my situation.
I installed a fresh copy of my own laravel, and I tried running php artisan list, which works.
Now, I have a colleague who has installed a copy of laravel himself, and he pushes his entire directory onto a git repository. I pulled the entire branch off the repository, and tried running php artisan list, but nothing happens this time. I mean, literally, nothing happens.
Any ideas as to why this is happening?
Generally speaking, the vendor directory is not committed to VCS, as such, doing a clone on a standard Laravel app won't include all its dependencies.
Once you have cloned, doing composer install (or composer update if you want the latest packages as a developer) will fetch the dependencies and allow your app to work.
You need to run composer install, so the composer refresh all dependencies, artisan's begin on the middle. That should do the job!
My artisan was not working because i had the following lines in my routes.php
if(!isset($_SESSION['c_id'])) {
header("Location: /login_page.php");
exit();
}
I simply commented the exit(). So my code becomes as follows
if(!isset($_SESSION['c_id'])) {
header("Location: /login_page.php");
// exit();
}
Just to point out some thing to anyone struggling with artisan, as this answer is 1st link in google to artisan CLI empty line:
It will print blank line whenever some error happens, even if you have all dependencies installed with composer install. And it won't tell you exactly what is wrong. I couldn't figure it out until I put into artisan file in the root directory this:
ini_set('display_errors',1);
error_reporting(-1);
That forced artisan CLI to show error message and therefore I was able to fix it (my .env file was broken).
Hope this helps someone.
Environment file is not usually pushed to repo.
Make sure you'd also put ".env" file at root path.
In my case problem was to connect artisan with database (migrates) i.e. the command
$php artisan migrate
was not working.
I was running laravel project on 8888 port.
In this case I updated .env file as:
DB_HOST=localhost to DB_HOST=localhost to DB_HOST=127.0.0.1
and DB_PORT=3306 to DB_PORT=8889
Cleared cache by running artisan command and run the migrates:
php artisan config:clear
php artisan migrate
delete the your php at your system , and install it again
or if you run the app, move project folder at htdocs in
xampp folder and type address in browser , localhost/your project name and your app is run on localhost

Unable to update Laravel 4 with Composer (Update: bug?)

Today, I pulled down the laravel/laravel repository from Github. I then ran php composer.phar install (as I normally would on my system, with a command window in the project directory). However, when I ran php composer.phar update, I received this error:
Everything installed just fine, and Laravel works as it should.
Any ideas what could be causing this issue?
Edit 1
artisan exists in the root of the project, but it throws an exception when I attempt to run php artisan optimize:
Side Note 1
If I try the alternative method (quicker) of installing Laravel (php composer.phar create-project laravel/laravel), I get the following:
Edit 2
Upon installation, I also get the same error, where it claims it cannot find artisan. Therefore, the installation does not fully complete. I believe that it is stopping when it wants to compile classes (or something to that effect), and then write bootstrap/compiled.php. That file doesn't exist.
Here's the snap from the install:
Edit 3
It seems that Composer is looking for artisan in the drive root (C:\). Why is it doing this? Even if I specify -d on the update, it throws the error. (I picked this up from a hunch - simply copied artisan to the root of the drive and it found it - albeit, it obviously did not run...)
Solution Found:
Composer makes calls to php artisan <command> (as per the instruction in composer.json > scripts), but it does not see what directory it is running from (perhaps because it is an external command?).
So, I solved my initial problem by using an absolute path to artisan in composer.json.
Everything is working now. I just wish I knew how to get Composer to know that it is running from C:\LocalServer\lab\laravel, and not just C:\.
As i can see, your artisan file is missing. Can you post the exact steps on how you install it ?
Also, please follow http://laravel.com/docs/installation and http://niallobrien.me/2013/03/installing-and-updating-laravel-4/
I had this problem today too. My laravel folder inside the vendor was deleted after composer update. I ran composer install again and problem resolved.

Categories