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:
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.
-
@Pete-S said in Installing Laravel on Ubuntu 20.04:
If you do php -i | grep .ini you can see which config file the installed php is actually using.
You are correct, I checked and it's using CLI, not Apache. This is why I was writing the article, every freaking resource I can find on a Laravel install makes wild, awful assumptions like running as room, or installing Apache, even when they don't say it.
-
@scottalanmiller said in Installing Laravel on Ubuntu 20.04:
@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.
Yes, it does. But by using the php package and not php-cli, you probably got apache installed on your system as well - by dependencies.
You could find out if it's installed by running:
apt list --installed | grep apache
-
@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:
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.
Yes, it does. But by using the php package and not php-cli, you probably got apache installed on your system as well - by dependencies.
You could find out by running:
apt list --installed | grep apache
Or
systemctl status apache2
to see if it's running. -
@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:
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.
Yes, it does. But by using the php package and not php-cli, you probably got apache installed on your system as well - by dependencies.
You could find out if it's installed by running:
apt list --installed | grep apache
I meant php-cli gets installed.
I know that Apache is there but never used.
-
@Pete-S 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:
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.
Yes, it does. But by using the php package and not php-cli, you probably got apache installed on your system as well - by dependencies.
You could find out by running:
apt list --installed | grep apache
Or
systemctl status apache2
to see if it's running.Even if it was, Laravel uses Artisan's server.
-
@scottalanmiller said in Installing Laravel on Ubuntu 20.04:
@Pete-S 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:
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.
Yes, it does. But by using the php package and not php-cli, you probably got apache installed on your system as well - by dependencies.
You could find out by running:
apt list --installed | grep apache
Or
systemctl status apache2
to see if it's running.Even if it was, Laravel uses Artisan's server.
I'm guessing they are invoking php's built-in webserver.
Regardless, the point is that if you swap
php
tophp-cli
in your install guide you don't get apache and other stuff you don't need.