GithubHelp home page GithubHelp logo

Add default setup for PHP about omakub HOT 14 CLOSED

dhh avatar dhh commented on August 10, 2024 13
Add default setup for PHP

from omakub.

Comments (14)

jasonmccallister avatar jasonmccallister commented on August 10, 2024 4

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?

from omakub.

csfh avatar csfh commented on August 10, 2024 2

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

from omakub.

florentdestremau avatar florentdestremau commented on August 10, 2024 1

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

from omakub.

nickchomey avatar nickchomey commented on August 10, 2024 1

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

from omakub.

TerrorSquad avatar TerrorSquad commented on August 10, 2024 1

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.

from omakub.

jasonmccallister avatar jasonmccallister commented on August 10, 2024 1

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

from omakub.

osbre avatar osbre commented on August 10, 2024 1

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.

from omakub.

florentdestremau avatar florentdestremau commented on August 10, 2024

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.

from omakub.

blankRSD avatar blankRSD commented on August 10, 2024

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.

from omakub.

roelandmoors avatar roelandmoors commented on August 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?

from omakub.

nickchomey avatar nickchomey commented on August 10, 2024

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/`

from omakub.

csfh avatar csfh commented on August 10, 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.

from omakub.

roelandmoors avatar roelandmoors commented on August 10, 2024

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

I agree, PR #87 is installing that.

from omakub.

florentdestremau avatar florentdestremau commented on August 10, 2024

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.

from omakub.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.