So I work on a Laravel project for university. We are a team of 7. I have been using like everyone else windows and homestead/vagrant for the last 6 months. My windows laptop broke down and I can’t get it to work anymore. Everyone of our group has tried to help me but it wont work. So I decided to try to work with Linux (ubuntu 18.04) as I hope it is easier to set up the development environment and my 2. laptop is slow as f.
I managed to create a new Laravel project and let it run locally but I can’t load the existing project. How do I get it to work? I tried to run php artisan serve
from the project directory. I have to be honest, the first time someone else from the team set it up (we got a step by step instruction) and I don’t really know what I am doing.
As of my understanding I should be able to run the project from the folder.
If anyone can help me somehow (Even Teamviewer would be possible) this wold be wonderful. The PC only runs Ubuntu and there is absolutely no private data on it and if it crashes I can just reinstall Ubuntu. I have been trying for 20h + (counting the time invested trying to get it to work on Windows) and I have given up. The other members of my team understand, but I don’t want them to do all the work.
I will be awake for another 2h (it is 0:00h here in Switzerland).
Please Help
Janick Spielmann
p.s
everything is in German but I can translate everything.
Hey friend! So, I’m not familiar with XAMPP, but it looks like it still uses/simulates Apache?
Running the Laravel sample project vs your home project, what are the differences? When you run php artisan serve does it tell you it’s running on localhost:8000 or does it tell you something else, like an error?
I have not used Laravel in a long time, so I’m a bit rusty on how the artisan command works. You might just have to change the virtual host/XAMPP to point to your project directory.
Also, I loved Homestead! I used it with Vagrant, like you did, before I knew about Docker. Vagrant/VirtualBox will run on Ubuntu.
However, it looks like it is available as a Docker container, which will run natively on Ubuntu after installing Docker. Check it out!
EDIT ALL THE THINGS: So… now that I am using my notebook instead of my phone I can type/google/try-things properly…
You gotta install your dependencies with composer and I think also npm in many cases (or at least my project i did half a year ago sure has a package.json so that would imply I will have to npm instlall the packages). Laravel also generates a .gitignore to ignore the effectively useless folders in version control and just uploads the composer.json, composer.lock and package.json etc files that describe what packages and what version of those packages where installed in witch order and when and how etc… so you can reinstall them in a reproduceable way. Better than clunking up your git server with the full fat libraries you use.
Runningcomposer install is a start. Then try php artisan serve again.
If that does not do it also try npm install and try php artisan serve again.
You might also have to do php artisan migrate if you’re using a database to run the migration scripts on it.
I just did install ubuntu-server in a vm to try and get my old laravel project to work. This is what I did. There might additionally also be some other stuff involved if you also depend on a database. But this is basically getting it to work. Since you already had a new laravel project running a lot of this may not be required and you can just run composer install instead (maybe).
clone project from git or whatever
sudo apt install php install php
getting composer
mkdir ~/Downloads make download dir if you don’t have one [optional]
cd ~/Downloads goto that dir or wherever you want to downlod it to
curl -sS https://getcomposer.org/installer -o composer-setup.php download composer (if curl does not exist for some reason sudo apt install curl or something like that it did exist for me though)
typing composer should now output the help/usage text
Went to project dir ran composer install
However it said php-mbstring not installed
apt install php-mbstring
the next steps are only in case you don’t find the packages, it didn’t for me, but i installed ubuntu-server, it might be there on ubuntu-desktop by default
sudo nano /etc/apt/sources.list or use another editor of your choice
put the following into there
deb http://archive.ubuntu.com/ubuntu bionic main universe
deb http://archive.ubuntu.com/ubuntu bionic-security main universe
deb http://archive.ubuntu.com/ubuntu bionic-updates main universe
sudo apt update && sudo apt install php-mbstring
ran composer install again
gave me this phpunit/phpunit 6.5.8 requires ext-dom * -> the requested PHP extension dom is missing from your system.
solution: run apt install php-xml
run composer install again now it worked for me
Now you can php artisan serve
This is not really a deffinitive guide, but rather just the things copy pasted I entered into my terminal to get my old trial project to function on a new install of ubuntu-server.
Here are the sources I used (maybe they are helpful).
I get that but if I don’t run as root there are some ::
Cannot create cache directory /home/developer/.composer/cache/repo/https—repo.packagist.org/, or directory is not writable. Proceeding without cache
Cannot create cache directory /home/developer/.composer/cache/files/, or directory is not writable. Proceeding without cache
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for adldap2/adldap2 v7.0.15 -> satisfiable by adldap2/adldap2[v7.0.15].
- adldap2/adldap2 v7.0.15 requires ext-ldap * -> the requested PHP extension ldap is missing from your system.
Problem 2
- Installation request for facebook/webdriver 1.6.0 -> satisfiable by facebook/webdriver[1.6.0].
- facebook/webdriver 1.6.0 requires ext-curl * -> the requested PHP extension curl is missing from your system.
Problem 3
- adldap2/adldap2 v7.0.15 requires ext-ldap * -> the requested PHP extension ldap is missing from your system.
- adldap2/adldap2-laravel v3.0.9 requires adldap2/adldap2 7.0.* -> satisfiable by adldap2/adldap2[v7.0.15].
- Installation request for adldap2/adldap2-laravel v3.0.9 -> satisfiable by adldap2/adldap2-laravel[v3.0.9].
To enable extensions, verify that they are enabled in your .ini files:
- /etc/php/7.2/cli/php.ini
- /etc/php/7.2/cli/conf.d/10-opcache.ini
- /etc/php/7.2/cli/conf.d/10-pdo.ini
- /etc/php/7.2/cli/conf.d/15-xml.ini
- /etc/php/7.2/cli/conf.d/20-calendar.ini
- /etc/php/7.2/cli/conf.d/20-ctype.ini
- /etc/php/7.2/cli/conf.d/20-dom.ini
- /etc/php/7.2/cli/conf.d/20-exif.ini
- /etc/php/7.2/cli/conf.d/20-fileinfo.ini
- /etc/php/7.2/cli/conf.d/20-ftp.ini
- /etc/php/7.2/cli/conf.d/20-gettext.ini
- /etc/php/7.2/cli/conf.d/20-iconv.ini
- /etc/php/7.2/cli/conf.d/20-json.ini
- /etc/php/7.2/cli/conf.d/20-mbstring.ini
- /etc/php/7.2/cli/conf.d/20-phar.ini
- /etc/php/7.2/cli/conf.d/20-posix.ini
- /etc/php/7.2/cli/conf.d/20-readline.ini
- /etc/php/7.2/cli/conf.d/20-shmop.ini
- /etc/php/7.2/cli/conf.d/20-simplexml.ini
- /etc/php/7.2/cli/conf.d/20-sockets.ini
- /etc/php/7.2/cli/conf.d/20-sysvmsg.ini
- /etc/php/7.2/cli/conf.d/20-sysvsem.ini
- /etc/php/7.2/cli/conf.d/20-sysvshm.ini
- /etc/php/7.2/cli/conf.d/20-tokenizer.ini
- /etc/php/7.2/cli/conf.d/20-wddx.ini
- /etc/php/7.2/cli/conf.d/20-xmlreader.ini
- /etc/php/7.2/cli/conf.d/20-xmlwriter.ini
- /etc/php/7.2/cli/conf.d/20-xsl.ini
- /etc/php/7.2/cli/conf.d/20-zip.ini
You can also run php --ini inside terminal to see which files are used by PHP in CLI mode.
I don’t know how to fix the other problems.
I suppose it’s a version conflict. My Laravel-project is about 5 Jears old and we are using php 7.2.15 I think.
I got it to work on my Windows machine again Mi sisters boyfriend is a hero and a php developer.
But I want to move to Linux anyway so it would be cool to be able to use this laptop for the project.
Can i somehow rollback composer and php to the projects version?
And replace YOUR_USER with well… your user you use composer with. From what I understand when you ran composer as root to start with it generates the folders as root, so they will be owned by root and you can´t write to them.
Then it will probably work without sudo, but I didn´t have that problem.
For the rest you´re appearently missing ext-curl and ext-ldap for php.