Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add default setup for PHP #73

Closed
dhh opened this issue Jun 10, 2024 · 14 comments · Fixed by #87
Closed

Add default setup for PHP #73

dhh opened this issue Jun 10, 2024 · 14 comments · Fixed by #87

Comments

@dhh
Copy link
Member

dhh commented Jun 10, 2024

Omakub should be for developers from a large number of communities, and it should work out of the box for them. What's needed for an out-of-the-box experience for PHP, say, someone developing Laravel?

@florentdestremau
Copy link
Contributor

I have a very simple setup on my fork, works like a charm since my install 3 days ago: https://github.com/florentdestremau/omakub/blob/master/install/php.sh

I'm a Symfony developper so I don't have a good idea of where Laravel might need some tweaks, and it includes extensions that are specific for my project (and some choices such as db drivers).

It also includes the Symfony console so that's framework-specific too.

@blankRSD
Copy link

For Laravel, one of the easiest way to setup a complete dev environment is to use Sail which packages all the docker dependencies for each project.

Otherwise, LEMP stack is still one of the most used stack.

@florentdestremau
Copy link
Contributor

florentdestremau commented Jun 10, 2024

I think the philosophy here is to be as straightforward as possible, rather than relying on Docker. PHP runs perfectly fine with the apt packages and it's the default installation any newcomer would expect / be able to debug on their own

@nickchomey
Copy link

nickchomey commented Jun 10, 2024

DDEV is, without question, the tool for this (and many other) job

It is written in Go and is docker-based, supports like 20 CMSs, different languages (php, js, python - I see no reason why it couldn't also support ruby), does SSL, allows sharing via public domain, works across OSs, has strong corporate backing but also a non-profit foundation, etc...

For PHP, in particular, it allows you to seamlessly toggle debugging and profiling tools like xdebug, xhprof, etc...

Easy to add different databases, search engines, etc...

I only discovered it last week, but I cannot speak highly enough of it. It's painful to think of the amount of hassle it could have saved me over the years

@TerrorSquad
Copy link

PHP installed via APT should be enough for execution of some random scripts when you need an PHP interpreter.

But for actual projects, having a complete dedicated environment is a must. DDEV is the de-facto standard for this. You install it once globally and then use it to create an environment for each project you're working on.
https://ddev.readthedocs.io/en/latest/users/quickstart/#laravel

I've been using it for a few projects (php7.4, 8.2 and 8.3), it's great. You can customize it with custom scripts and Dockerfiles.

Another great environment I used a lot (~4 years) is https://github.com/markshust/docker-magento - this one is specific to Magento 2 though and is a better choice for it than DDEV.

@roelandxyz
Copy link
Contributor

roelandxyz commented Jun 10, 2024

This installs the current PHP and Composer:

sudo apt install php-fpm php-cli php-xml php-mbstring php-intl

EXPECTED_CHECKSUM="$(php -r 'copy("https://composer.github.io/installer.sig", "php://stdout");')"
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
ACTUAL_CHECKSUM="$(php -r "echo hash_file('sha384', 'composer-setup.php');")"

if [ "$EXPECTED_CHECKSUM" != "$ACTUAL_CHECKSUM" ]
then
    >&2 echo 'ERROR: Invalid installer checksum'
    rm composer-setup.php
    exit 1
fi

php composer-setup.php --quiet
RESULT=$?
rm composer-setup.php

mv composer.phar ~/.local/bin/composer 

But if you need an other PHP version or multiple versions I guess DDEV is better, but I never used it. Maybe PHP should be in the optional folder?

@jasonmccallister
Copy link
Contributor

jasonmccallister commented Jun 10, 2024

DDEV might be overkill, especially for projects that are not supported - I have always defaulted to using this PPA https://launchpad.net/~ondrej/+archive/ubuntu/php on Ubuntu installs to get the latest version of PHP.

Since Ruby and Go are installed on the system with mise, might make sense to also install PHP on the system?

@nickchomey
Copy link

DDEV might be overkill, especially for projects that are not supported

DDEV works for any php project with its default php project type. https://ddev.readthedocs.io/en/stable/users/project/`

@jasonmccallister
Copy link
Contributor

Good point @nickchomey, I still think its overkill for installing PHP on the system

@csfh
Copy link

csfh commented Jun 11, 2024

I think it's worth considering using Valet instead of Sail. Or at least give both options.

I started out with Sail myself but after a while I find Valet and Herd to be better for local development for Laravel.

@osbre
Copy link

osbre commented Jun 12, 2024

IMO, the best way to get PHP is via ppa:ondrej/php. It's becoming a standard practice on the server as everyone trusts this repo and it's good.

Additionally, the fork of Laravel Valet for Linux exists, but it would probably be overkill because it installs Nginx and DnsMasq.

@csfh
Copy link

csfh commented Jun 12, 2024

Maybe we start simple. ondrej + composer. Which extensions should be included?

@roelandxyz
Copy link
Contributor

Maybe we start simple. ondrej + composer. Which extensions should be included?

I agree, PR #87 is installing that.

@florentdestremau
Copy link
Contributor

I added very basic ones with the 3 main db drivers. Doesn't hurt to put too much extensions but I guess it could scare some people away ? We're back to the debat on having all defaults vs "bundles" of dev environments. IMO I would keep the minimal, most projects have their own README::Install anyways, and most frameworks for beginners have their own self check as well.

@dhh dhh closed this as completed in #87 Jun 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants