News for hackers. Stuff that matters.
Re:Show HN: A self-hosted email engine by lykr0n on Thursday January 30, 2020 @11:43AM (#22192751)
Awesome. We can never have enough of high quality self hosted software.
Re:Show HN: A self-hosted email engine by ultrarunner on Thursday January 30, 2020 @12:00PM (#22192935)
As someone who has been out of the PHP game for a long time, is it still a viable choice for new software? I don't have fond memories of the language at that time, so seeing PHP in the demo video poster frame was an immediate mark against pitching this at my company. That made me wonder whether it's a reasonable reaction to have.

Edit for the downvoters— this is an honest question and I very much agree that we can never have too much high-quality self-hosted software. If that can be done with PHP I'm open-minded.

Re:Show HN: A self-hosted email engine by Isinlor on Thursday January 30, 2020 @01:11PM (#22193664)
PHP is a very good choice. If you want to refresh your knowledge of PHP take a look here: https://phptherightway.com/

It's fast. PHP has great documentation. PHP ecosystem is now based around Composer, in comparison to mess of package management in JavaScript and Python, Composer is just wonderful to use. Packagist has ton of libraries. Share nothing architecture is very easy to maintain and scale. You can do strict typing. There are static code analysis libraries like Psalm and PHPStan if you want features normally offered by compilers. It's easy to hire devs. There are two wonderful frameworks that moder PHP is centered around: Laravel and Symfony. There is also community body issuing standards to ease framework interoperability: https://www.php-fig.org/psr/

The app seems to be written in Laravel, so you can take a look here if it's your coup of tea: https://laravel.com/

Having said that, Wordpress and other old code bases are still a mess. But stable mess, and business like stable :) .

Re:Show HN: A self-hosted email engine by LeifCarrotson on Thursday January 30, 2020 @02:40PM (#22194659)
The hazard is that it was such a big mess in the past that if you want to hire someone to work on your self-hosted app, there are going to be a lot of applicants who want to use PHP the wrong way.
Re:Show HN: A self-hosted email engine by smacktoward on Thursday January 30, 2020 @03:30PM (#22195211)
So use PHPTheRightWay to come up with some interview questions to filter those folks out. Problem solved!
Re:Show HN: A self-hosted email engine by theamk on Thursday January 30, 2020 @03:54PM (#22195462)
I did a quick look through PhpTheRightWay website, and I saw no mention of the advice that php user should have no permissions to change app code -- or in other words, that "deploy" and "run" users should be different.

Is this the recommended practice now? Because that was the main reason to avoid PHP codebases for me. Having an app where any code execution bug instantly leads to permanent compromise scares me deeply.

Re:Show HN: A self-hosted email engine by Isinlor on Thursday January 30, 2020 @06:10PM (#22196982)
PHP was never receiving requests directly from the Internet. It was always a standard practice to talk to PHP trough a server. The separation between what you call deploy and run user is what you get as default by using Nginx or Apache on Ubuntu (root vs. www-data). If you feel very paranoid and don't mind some complexity you can put PHP code into a docker container and run it from there. In that setup, attacker targeting PHP code would need to break out of docker container to take full control over the server.
Re:Show HN: A self-hosted email engine by theamk on Friday January 31, 2020 @12:00AM (#22199206)
That sounds nice -- but does this happens often in PHP world? Last PHP project I tried to install was OwnCloud, and it explicitly says (in [0]):

> Your HTTP user must own the config/, data/, apps/ respectively the apps-external/ directories so that you can configure ownCloud, create, modify and delete your data files, and install apps via the ownCloud Web interface.

[0] https://doc.owncloud.org/server/10.4/admin_manual/installati...

Re:Show HN: A self-hosted email engine by Isinlor on Friday January 31, 2020 @04:23AM (#22200258)
A lot of PHP apps allow you to install plugins from within the app itself, without going trough the whole process of deployment. The app has to modify it's own code in that scenario. This is independent from programming language. If you allow users to independently install plugins you will allow them to execute third-party code - it's true for all programming languages.

I don't know ownCloud, but I would guess they have an option to disable plugin installation.

And as I said, if you feel paranoid, you can install PHP apps in docker container: https://doc.owncloud.org/server/10.4/admin_manual/installati...

Re:Show HN: A self-hosted email engine by penagwin on Thursday January 30, 2020 @12:25PM (#22193222)
The latest versions of PHP aren't too bad.

That said Node.js has IMO an interesting architecture because it's event driven, combine that with Typescript and it's solid.

Python type support, and event driven frameworks (e.g. async/await) were only (fairly) recently made accessible, there's a few frameworks that can utilize it well like FastAPI, but many of the popular ones like Django are still behind on async/await support for the a lot of features like the ORM and still is lacking typing support. IMO the python web development system is going to be really awesome once Django gets robust types and async support.

Disclaimer: Current job uses python/Django and js. I have little experience with other languages/frameworks.

Re:Show HN: A self-hosted email engine by robjan on Thursday January 30, 2020 @12:03PM (#22192970)
PHP is getting a lot better these days. There is still a lot of clunky legacy syntax but the performance and features are pretty much on par with other scripting languages now.
Re:Show HN: A self-hosted email engine by lykr0n on Thursday January 30, 2020 @01:31PM (#22193873)
Even better in some cases. PHP is slamming raw c function calls for some stuff, which makes some operations as fast as compiled binaries.
Re:Show HN: A self-hosted email engine by mekster on Friday January 31, 2020 @10:56AM (#22202652)
When you can't exactly tell what was bad about PHP, then it may just be an impression given to you from a lousy programmer who would just blame the tools instead or from some messy code which apparently isn't the fault of the language.

What's wrong about it really?

If you're an author of an opensource web app, it's a smart choice to pick PHP to have as much audience as you could get. PHP is the primary candidate for any VPS.

Re:Show HN: A self-hosted email engine by mikece on Thursday January 30, 2020 @02:34PM (#22194595)
I understand not wanting to write PHP for an app I have to maintain as part of my daily work, but for something like this where you want to sell it to anyone and have it run anywhere, it's hard to be more universal than "PHP and MySQL" (though it does make me smile when SQLite is an option as well).