Installing Laravel on Ubuntu 20.04
-
Another question about composer.
It's a package manager right? Why do they use that instead of the package manager for the OS?
And when you do
composer global require laravel/installer
I assume it downloads laraval and the installer? Why did you manually have to load all the php-packages if those are required for the laravel package?I can't understand why they made it so you need to use two package managers and why they don't appear to be integrated at all.
The entire idea of a package manager is that you can easily install what you want and all dependencies are taken care of.
Like,apt install laravel
and you're done. -
@Pete-S said in Installing Laravel on Ubuntu 20.04:
I don't understand why you have to uncomment lines in the php.ini for fileinfo & openssl extensions but not the others?
Because they are part of php-common, so automatically installed, but all the pieces of common are commented out so you have to turn them on. Those two are required, so you have to enable them since you cant install them on their own.
php-openssl doesn't exist anymore, hence the issue.
-
@Pete-S said in Installing Laravel on Ubuntu 20.04:
The entire idea of a package manager is that you can easily install what you want and all dependencies are taken care of.
Like, apt install laravel and you're done.Sort of, but there are definite differences. For example, installing composer is a system-wide installation; an OS level installation.
Composer is for user-level installs into your own home directory. And it is packages from "inside an application". This is the same anywhere. If you add something inside of an app, it's traditional for the app itself to handle it.
In many cases you can use either. But to standardize development across operating systems essentially all programming languages have their own development managers. NodeJS, PHP, Java, Go, Python, Ruby.... it's for lots of reasons. But primarily because one is run by the user, one by the admin.
-
@Pete-S said in Installing Laravel on Ubuntu 20.04:
And when you do composer global require laravel/installer I assume it downloads laraval and the installer? Why did you manually have to load all the php-packages if those are required for the laravel package?
So in this case you need the system admin to install the PHP packages. They are system level packages. But the end user is downloading scripts to run themselves with Laravel.
-
@scottalanmiller said in Installing Laravel on Ubuntu 20.04:
@Pete-S said in Installing Laravel on Ubuntu 20.04:
I don't understand why you have to uncomment lines in the php.ini for fileinfo & openssl extensions but not the others?
Because they are part of php-common, so automatically installed, but all the pieces of common are commented out so you have to turn them on. Those two are required, so you have to enable them since you cant install them on their own.
php-openssl doesn't exist anymore, hence the issue.
I don't quite understand. You have php-openssl as one of the packages you install on the first line. If it's already installed by default from the php metapackage, you could omit that right?
-
@Pete-S said in Installing Laravel on Ubuntu 20.04:
I can't understand why they made it so you need to use two package managers and why they don't appear to be integrated at all.
While certainly possible, you can imagine the problems that would arise when you want to install different PHP packages or conflicting versions for each user. You want developers to be isolated from one another. Can you do that with system admin level installs? Yes, but it would be complex. Can you do that with end users doing their own installs?
That's really the biggest thing, devs need control of their frameworks differently from software packages. I think that looking at Laravel as a package is the wrong way to think of it. Think of it like downloading some code to build off of, that there is some automation to make it easier to work with makes it misleading.
If you were a dev, and wanted to work with some code components you found online, you'd just download the code and edit it to get started. You'd not think of having the admin install something.
Think of it like Git in that regard. Composer is closer to Git than to DNF/APT. And in fact, in many cases, it's Git that you'd use instead.
-
@Pete-S said in Installing Laravel on Ubuntu 20.04:
@scottalanmiller said in Installing Laravel on Ubuntu 20.04:
@Pete-S said in Installing Laravel on Ubuntu 20.04:
I don't understand why you have to uncomment lines in the php.ini for fileinfo & openssl extensions but not the others?
Because they are part of php-common, so automatically installed, but all the pieces of common are commented out so you have to turn them on. Those two are required, so you have to enable them since you cant install them on their own.
php-openssl doesn't exist anymore, hence the issue.
I don't quite understand. You have php-openssl as one of the packages you install on the first line. If it's already installed by default from the php metapackage, you could omit that right?
Ah, that was a mistake. I ran that command by mistake and it wasn't needed, but was in my command history and I copied it. It was needed on older Ubuntu, but 20.04 moved it into php-common and changed how it works.
-
@scottalanmiller said in Installing Laravel on Ubuntu 20.04:
@Pete-S said in Installing Laravel on Ubuntu 20.04:
The entire idea of a package manager is that you can easily install what you want and all dependencies are taken care of.
Like, apt install laravel and you're done.Sort of, but there are definite differences. For example, installing composer is a system-wide installation; an OS level installation.
Composer is for user-level installs into your own home directory. And it is packages from "inside an application". This is the same anywhere. If you add something inside of an app, it's traditional for the app itself to handle it.
In many cases you can use either. But to standardize development across operating systems essentially all programming languages have their own development managers. NodeJS, PHP, Java, Go, Python, Ruby.... it's for lots of reasons. But primarily because one is run by the user, one by the admin.
OK, so your post is the installation of the development environment using laravel and not when you install a laravel web application on a production server?
Otherwise it would be the admin that installs it all.
-
@Pete-S said in Installing Laravel on Ubuntu 20.04:
@scottalanmiller said in Installing Laravel on Ubuntu 20.04:
@Pete-S said in Installing Laravel on Ubuntu 20.04:
The entire idea of a package manager is that you can easily install what you want and all dependencies are taken care of.
Like, apt install laravel and you're done.Sort of, but there are definite differences. For example, installing composer is a system-wide installation; an OS level installation.
Composer is for user-level installs into your own home directory. And it is packages from "inside an application". This is the same anywhere. If you add something inside of an app, it's traditional for the app itself to handle it.
In many cases you can use either. But to standardize development across operating systems essentially all programming languages have their own development managers. NodeJS, PHP, Java, Go, Python, Ruby.... it's for lots of reasons. But primarily because one is run by the user, one by the admin.
OK, so your post is the installation of the development environment using laravel and not when you install a laravel web application on a production server?
Correct, you install Laravel for development. When you install production apps, you don't know what framework that they are written in or manage that stuff. Generally.
That's not 100% true. It's common to do it both ways. One where you leave loads of needed packages out and expect the installer to go out and get that code, this is sometimes done for licensing reasons. But typically you package all of your code into a single installer.
So, as an example, it would be standard to use Laravel to build an app that you want to sell. Then when people deploy it, say on CentOS, you provide a single RPM for the installation of your app.
-
@scottalanmiller said in Installing Laravel on Ubuntu 20.04:
@Pete-S said in Installing Laravel on Ubuntu 20.04:
@scottalanmiller said in Installing Laravel on Ubuntu 20.04:
@Pete-S said in Installing Laravel on Ubuntu 20.04:
I don't understand why you have to uncomment lines in the php.ini for fileinfo & openssl extensions but not the others?
Because they are part of php-common, so automatically installed, but all the pieces of common are commented out so you have to turn them on. Those two are required, so you have to enable them since you cant install them on their own.
php-openssl doesn't exist anymore, hence the issue.
I don't quite understand. You have php-openssl as one of the packages you install on the first line. If it's already installed by default from the php metapackage, you could omit that right?
Ah, that was a mistake. I ran that command by mistake and it wasn't needed, but was in my command history and I copied it. It was needed on older Ubuntu, but 20.04 moved it into php-common and changed how it works.
OK, that makes sense. I saw you changed the post as well.
-
@Pete-S said in Installing Laravel on Ubuntu 20.04:
Otherwise it would be the admin that installs it all.
Exactly, Laravel is "code for developers to use as a baseline" for development. Whereas something made with Laravel would be expected to be deployed by an admin to be run as a server.
-
@Pete-S said in Installing Laravel on Ubuntu 20.04:
@scottalanmiller said in Installing Laravel on Ubuntu 20.04:
@Pete-S said in Installing Laravel on Ubuntu 20.04:
@scottalanmiller said in Installing Laravel on Ubuntu 20.04:
@Pete-S said in Installing Laravel on Ubuntu 20.04:
I don't understand why you have to uncomment lines in the php.ini for fileinfo & openssl extensions but not the others?
Because they are part of php-common, so automatically installed, but all the pieces of common are commented out so you have to turn them on. Those two are required, so you have to enable them since you cant install them on their own.
php-openssl doesn't exist anymore, hence the issue.
I don't quite understand. You have php-openssl as one of the packages you install on the first line. If it's already installed by default from the php metapackage, you could omit that right?
Ah, that was a mistake. I ran that command by mistake and it wasn't needed, but was in my command history and I copied it. It was needed on older Ubuntu, but 20.04 moved it into php-common and changed how it works.
OK, that makes sense. I saw you changed the post as well.
I did, I took out the duplicated packages.
-
@scottalanmiller said in Installing Laravel on Ubuntu 20.04:
@Pete-S said in Installing Laravel on Ubuntu 20.04:
@scottalanmiller said in Installing Laravel on Ubuntu 20.04:
@Pete-S said in Installing Laravel on Ubuntu 20.04:
The entire idea of a package manager is that you can easily install what you want and all dependencies are taken care of.
Like, apt install laravel and you're done.Sort of, but there are definite differences. For example, installing composer is a system-wide installation; an OS level installation.
Composer is for user-level installs into your own home directory. And it is packages from "inside an application". This is the same anywhere. If you add something inside of an app, it's traditional for the app itself to handle it.
In many cases you can use either. But to standardize development across operating systems essentially all programming languages have their own development managers. NodeJS, PHP, Java, Go, Python, Ruby.... it's for lots of reasons. But primarily because one is run by the user, one by the admin.
OK, so your post is the installation of the development environment using laravel and not when you install a laravel web application on a production server?
Correct, you install Laravel for development. When you install production apps, you don't know what framework that they are written in or manage that stuff. Generally.
That's not 100% true. It's common to do it both ways. One where you leave loads of needed packages out and expect the installer to go out and get that code, this is sometimes done for licensing reasons. But typically you package all of your code into a single installer.
So, as an example, it would be standard to use Laravel to build an app that you want to sell. Then when people deploy it, say on CentOS, you provide a single RPM for the installation of your app.
That sounds logical , thanks!
-
Just a side note, but you are implying you already have
apache
up and running - since that is where you changed the php.ini files.Do laravel have any module requirements or needed config settings for apache as well?
It's for example not unusual that you need to have
mod_rewrite
to beautify URLs or that you need to have htaccess files allowed etc. -
@Pete-S said in Installing Laravel on Ubuntu 20.04:
Just a side note, but you are implying you already have
apache
up and running - since that is where you changed the php.ini files.Do laravel have any module requirements or needed config settings for apache as well?
It's for example not unusual that you need to have
mod_rewrite
to beautify URLs or that you need to have htaccess files allowed etc.Perhaps you should assume a newly installed, clean ubuntu 20.04 as your base system.
-
@Pete-S said in Installing Laravel on Ubuntu 20.04:
Just a side note, but you are implying you already have
apache
up and running - since that is where you changed the php.ini files.Do laravel have any module requirements or needed config settings for apache as well?
It's for example not unusual that you need to have
mod_rewrite
to beautify URLs or that you need to have htaccess files allowed etc.No Apache, that's a PHP config file. You don't really use Apache in development, you can even test applications using Artisan with PHP in user space. I don't use Apache for production deployments either, we use Nginx.
-
@Pete-S said in Installing Laravel on Ubuntu 20.04:
@Pete-S said in Installing Laravel on Ubuntu 20.04:
Just a side note, but you are implying you already have
apache
up and running - since that is where you changed the php.ini files.Do laravel have any module requirements or needed config settings for apache as well?
It's for example not unusual that you need to have
mod_rewrite
to beautify URLs or that you need to have htaccess files allowed etc.Perhaps you should assume a newly installed, clean ubuntu 20.04 as your base system.
It is, the PHP package creates that directory.
-
Can’t php modules be enabled using
phpenmod
? -
@scottalanmiller said in Installing Laravel on Ubuntu 20.04:
@Pete-S said in Installing Laravel on Ubuntu 20.04:
Just a side note, but you are implying you already have
apache
up and running - since that is where you changed the php.ini files.Do laravel have any module requirements or needed config settings for apache as well?
It's for example not unusual that you need to have
mod_rewrite
to beautify URLs or that you need to have htaccess files allowed etc.No Apache, that's a PHP config file. You don't really use Apache in development, you can even test applications using Artisan with PHP in user space. I don't use Apache for production deployments either, we use Nginx.
OK, if you are not running apache or nginx, you should install the
php-cli
package instead.The
php
package has dependencies on a webserver, apache by default, so it will install those packages as well. It will install php-cli too but in addition to that a lot of stuff you don't need.
Follow this to see what php actually installs: https://packages.ubuntu.com/focal/php7.4If you are running php from scripts, as has to be the case when you have no webserver, it's also very likely that it's not the apache2 php.ini file you want to change. It's most likely this one:
/etc/php/7.4/cli/php.ini
If you do
php -i | grep .ini
you can see which config file the installed php is actually using.It can be somewhat confusing since there are several php.ini and the cli and the apache/nginx module uses different ones by default. So it's easy to go change the first php.ini file you find and it turns out it's actually the one not being used. BTDT.
-
@Pete-S said in Installing Laravel on Ubuntu 20.04:
OK, if you are not running apache or nginx, you should install the php-cli package instead.
So that seems to get installed anyway as a dependency on its own.