unable to run laravel 4 - laravel

I thought it was about time to look at a PHP Framework so I chose laravel. However, getting it running is causing me grief.
I followed the video from nettuts installing laravel 4 and at 5.05mins into the video he uses the php command-line server command (available from 5.4) php -S localhost:8888 -t public/ followed by confirming that it works via localhost:8888 in the browser which displays 'Hello Wolrd!'
I have XAMPP installed and my version of PHP is 5.3.15. I attempted to test it by doing http://localhost/learning-laravel/public/
At this point I have already downloaded composer and installed the dependancies successfully.
But I keep getting the following error:
Warning: require(/Applications/XAMPP/xamppfiles/htdocs/learning-laravel/bootstrap/../vendor/autoload.php) [function.require]: failed to open stream: No such file or directory in /Applications/XAMPP/xamppfiles/htdocs/learning-laravel/bootstrap/autoload.php on line 17
Fatal error: require() [function.require]: Failed opening required '/Applications/XAMPP/xamppfiles/htdocs/learning-laravel/bootstrap/../vendor/autoload.php' (include_path='.:/Applications/XAMPP/xamppfiles/lib/php:/Applications/XAMPP/xamppfiles/lib/php/pear') in /Applications/XAMPP/xamppfiles/htdocs/learning-laravel/bootstrap/autoload.php on line 17
Inside my learning-laravel folder I do have bootstap/autoload.php
Can someone please help? Thanks.

I had another look at my folder structure and I noticed that composer had not run correctly and there were missing files. I've reinstalled it and it appears to be working.

Related

Why do I have to "composer install" whenever I switch to a branch? Does it kill my memory?

Context: I am roughly new to Laravel and Github. I am working on a project with 3 other people, and we have created all our individual branches. But every time, I switch to their branch (which I am to successfully) but whenever I am trying to run the server on port 8000 I get the following error:
C:\Users\Einstein\Documents\Program\Project>php artisan serve
PHP Warning: require(C:\Users\Einstein\Documents\Program\laravel\Project/vendor/autoload.php): failed to open stream: No such file or directory in C:\Users\Einstein\Documents\Program\laravel\Project\artisan on line 18
Warning: require(C:\Users\Einstein\Documents\Program\laravel\Project/vendor/autoload.php): failed to open stream: No such file or directory in C:\Users\Einstein\Documents\Program\laravel\Project\artisan on line 18
PHP Fatal error: require(): Failed opening required 'C:\Users\Einstein\Documents\Program\laravel\Project/vendor/autoload.php' (include_path='C:\xampp\php\PEAR') in C:\Users\Einstein\Documents\Program\laravel\Project\artisan on line 18
Fatal error: require(): Failed opening required 'C:\Users\Einstein\Documents\Program\laravel\Project/vendor/autoload.php' (include_path='C:\xampp\php\PEAR') in C:\Users...8```
However, I am to run the project whenever I perform composer install. Why is that so? It seems like I have to rerun the packages whenever I am switches to branches, does it kill my computer memory? If I have to reinstall packages (this is my assumption whenever I perform composer install) will kill my computer memory.
Thanks.
It is most likely because you are pulling in cached files calling the other peoples local paths and not yours. When you run composer install it pulls all the dependencies listed in the composer.json file to the /vendor folder, then rebuilds the config cache.
You can try and just rebuild the cache instead of re-installing all the dependencies with:
composer dump-autoload and php artisan clear:cache

Trying to problem solve "Fatal Errors" and "No Such File or Directory"

I'm at a total loss here.
All I am trying to do is clone a Laravel Project onto my local mac machine and I've probably spent 10 - 12 hours on this and I keep getting the same errors over and over.
I've tried Homestead, MAMP and now I am on Valet.
I can load the app but all the links are broken so the CSS and JS don't load.
After I clone (via bitbucket) the project I hit the test site on my machine and I get this error:
Warning: require(/Users/henry/sites/nestdb2017/bootstrap/../vendor/autoload.php): failed to open stream: No such file or directory in /Users/henry/sites/nestdb2017/bootstrap/autoload.php on line 17
Fatal error: require(): Failed opening required '/Users/henry/sites/nestdb2017/bootstrap/../vendor/autoload.php' (include_path='.:/usr/local/Cellar/php/7.3.9_1/share/php/pear') in /Users/henry/sites/nestdb2017/bootstrap/autoload.php on line 17
The next thing I do is I try to install the missing vendor files by doing this:
composer update --no-scripts
which then throw the broken links.
Literally I'm going to have to throw the towel in here...
It's unbelievable how hard this is.
Is it because the source files are corrupt in the first instance??
Try
composer install
php artisan clear-compiled
Then
composer dumpautoload
Tell us the results.

How to configure the Laravel built-in web server?

I am running this command:
C:\xampp\htdocs\notebook>php artisan serve
However I get this error:
Warning: require(C:\xampp\htdocs\notebook\bootstrap/../vendor/autoload.php): failed to open stream: No such file or directory in C:\xampp\htdocs\notebook\bootstrap\autoload.php on line 17
Fatal error: require(): Failed opening required 'C:\xampp\htdocs\notebook\bootstrap/../vendor/autoload.php' (include_path='.;C:\xampp\php\PEAR') in C:\xampp\htdocs\notebook\bootstrap\autoload.php on line 17
After creating a project or cloning existing one you should run composer install command which will install all dependecies and will create autoload.php file.
That is an import error.
Everytime you have one of these, you should try to run composer dump-autoload.
Most of the time, this command will fix your imports.
It looks like you might not have installed the required dependencies yet. You should do so using the composer package manager, like so:
C:\ProgramData\ComposerSetup\bin\composer install

Cloudstack client installation

I have XAMPP installed on Windows 10. And have successfully installed Composer, Laravel. I can see the basic Laravel project page on my local server.
Just to try things out I also installed yii2. I can see the basic yii2 page also on my local server.
Now I'm trying to install this Generic Cloudstack Client:
https://github.com/PCextreme/cloudstack-client
In XAMPP, under htdocs I have this dir called 'LaravelProjects'.
dir structure
First I made the project with the laravel command:
laravel new PCextreme
Then in PCextreme directory I give the command:
composer require pcextreme/cloudstack-client:~0.1
The composer breaks and shows Conclusion: remove laravel/framework 5.2.41
But in the instructions there is another method to install the package.
When I do that by editting the composer.json in the main Laravel dir. 'LaravelProjects' under xampp/htdocs with these lines:
"require": { "pcextreme/cloudstack-client": "~0.1" }
And then I run the "composer update" command.
I don't get any error.
But as soon as I follow these steps:
Once the package is installed you need to open app/config/app.php and register the required service provider:
`'providers' => [
'PCextreme\CloudstackClient\Providers\LaravelServiceProvider']`
The application breaks.
I can't see the basic page showing 'Laravel 5' on my server anymore.
Instead of that I get a fatal error:
Whoops, looks like something went wrong.
1/1 FatalErrorException in ProviderRepository.php line 146: Class
'PCextreme\CloudstackClient\Providers\LaravelServiceProvider' not found
Further in the instructions, when I give the command below:
php artisan config:publish pcextreme/cloudstack-client
I get this error:
[Symfony\Component\Debug\Exception\FatalErrorException]
Class 'PCextreme\CloudstackClient\Providers\LaravelServiceProvider' not found
I have tried out different things that I could find on internet but nothing seems to work in my case.
Could someone kindly help me out with this? Any help is greatly appreciated!
Execute in you project folder command: composer update

laravel 4 install issue when using composer install

When I run
composer.phar install
I get this error almost at the end of the installation, any ideas?
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Nothing to install or update
Generating autoload files
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /home/belendez/public_html/laravel/artisan on line 46
Parse error: syntax error, unexpected T_STRING in /home/belendez/public_html/laravel/artisan on line 46
Script php artisan optimize handling the post-install-cmd event returned with an error
I look into the suggested link and it appears that somehow in the middle of the installation it changes from 5.3 to 5.2! If I try to start installation using 5.2 it returns right a way: class 'Phar' not found. Any ideas?
It seems that issuing only a php command will pick up another version of the interpreter. Try to change all the references to php in your composer.phar file to the one you want actually to be executed (in your case it seems /opt/php53/bin/php).
You can confirm that by simply launching a php -v directly from the command line to see what version your server will pick up

Resources