Why can't I make a migration using artisan? - php

When I try to make a migration using
PHP artisan make: migration create_packages_table
I get this error. What does this mean?:

Ciao, as this guide said:
What you’re missing is running composer install, which will import your packages.
Try to do:
composer install
Or
composer update

I think you need to check your file permissions, in that case specifically in your database directory. From the laravel root directory do this:
cd database
ls -l
make sure you see the migrations directory and that it's writable for your current user.

Related

php laravel i have a problem in composer when install or remove packages or write any command for composer

PHP laravel I have a problem in composer when installing or remove packages or writing any command for the composer
first of all your composer command should be composer remove laravel/telescope instead of vendor/telescope.
you should rename this file from app/Models/Service_old.php to app/Models/Service.php, if there is another file in the same directory with the same Service.php name, then move the old one (or change its extension) somewhere else so it will not be auto detected by composer.
at last, while the package discovery issue is not provided in the screenshot, you may run the following commands and see how things went after:
composer clear-cache
composer dump-autoload
php artisan optimize:clear
Make sure your storage/ & bootstrap/cache directory writable.
Make sure your .env file doesn't contain any spaces.
Ex: key=value instead of key=va lue
remove the bootstrap/cache/config.php file. then
composer dump-autoload
Try to remove /bootstrap/compiled.php ( if you have it )
most likely the problem is with caching as all what we do here is remove the cached files

Is there a way to rename Hyperledger Fabric Composer command from 'composer' to something else?

After installing Hyperledger Fabric Composer I have had to create an alias for PHP Composer 'composer' command as running the command executes Hyperledger Composer instead due to name conflict. Is there a way to rename the Hyperledger Fabric Composer command rather than doing this for PHP Composer as the PHP Composer gets executes automatically when installing a number of frameworks etc. and obviously this results in an error. It would seem to me to make more sense to rename / alias Hyperledger Composer as this is almost always manually executed. Any ideas over my current approach very welcome.
Yes. You can add an alias in your ~/.bashrc . For example to rename it fcomposer:
alias fcomposer=/usr/bin/composer
Or you can simply have a softlink from a directory in your path. For example,
ln -s /usr/bin/composer /usr/local/bin/fcomposer
Ok, so I have managed to solve the issue in a few steps. I like Dan's fcomposer name above so I will use that.
Move the symlink for Hyperledger Composer (you can find out where it is located by running which composer at the prompt.
Create an alias (in .bash_aliases) for fcmposer and point to the new symlink name
Make sure your composer alias in .bashrc / .bash_aliases is linked to PHP composer
Going to +1 Dan's answer because it put me on the right path. Thanks Dan!

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.

Installing symfony with composer gives error

I have a arch linux droplet that I am trying to install symfony on. I got composer installed so I went to the directory I wanted the installation to go to and typed the composer create-project symfony/framework-standard-edition path/ 2.4.2 command. Then I got this error. This confuses me because it says that even though its right there in the list. Can someone help me find out how to fix this issue?
I restarted httpd after the change as well.
[ErrorException]
file_exists(): open_basedir restriction in effect. File(/root/.composer/.htaccess) is not within the allowed p
ath(s): (/srv/http/:/home/:/tmp/:/usr/share/pear/:/usr/share/webapps/:/usr/local/bin/:/root/.composer/.htacces
s/)
It looks like you've attempted to add the right directory to the open_basedir allowed paths as I see /root/.composer/.htaccess in the list. The problem is, this list should only contain existing directories.
A quick fix would be to change that entry to simply /root as Composer will then attempt to create .composer and .composer/.htaccess in /root.
A better solution would be to grant your user permission to create the project in the desired directory so you can run composer.
I am not sure if you moved composer.phar to the bin/composer folder or not, anyway try creating a Symfony folder in htdocs; inside the folder create composer.json which contains this ; now run this command in in terminal while you are redirected into the Symfony folder
php composer.phar install
If you have composer.phar in the same directory that command should work otherwise you need to use the full path of composer.phar in the top command

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