PHP

edgren,

The more I'm thinking about it, the more I consider it.

I want to add a map for my bicycle rides, but I can't find any good PHP maps. The PHP versions of Leaflet on GitHub are no good. They don't work at all. They just gives you errors like "can't load class" or something like that.

So even if I am against it only to challenge myself, I consider using Leaflet in JS for airikr.me/biking.

Or do you have any solution in PHP that works out of the box?

edgren,

@derickr Haha, you mean it's too small/pixelated? 😄

derickr,
@derickr@phpc.social avatar

@edgren I meant the track missing a little at the top. But also that... A little pixelated too.

I might also decided to create my own mapstyle, especially if it's always just a tiny area of a country / city.

Remember I said there are always more things to tweak? 😅

array,
@array@fosstodon.org avatar

My first was 8.0, still in school, and I confess that I began learning it with the prejudice of it being a junky, terrible language everybody was making fun of. Fast forward ~1 year later, after finishing my internship, where I used full stack mainly, and having discovered that not only it wasn't that bad, but really a pleasure to work with. Not perfect, but perfectly suitable for its use cases and, what's perfect anyway? So reading this has been a joy. :D https://developerjoy.co/blog/php-doesnt-suck-anymore

ntha,
@ntha@mastodon.social avatar

@array @hydrian @blu256 Do you assign data to Dto/Model classes (for better editor integration) or just keep it as a HashMap of some kind? In PHP I've been lazy and just keep everything as an array, even though for type support casting to a Model class would be better.

array,
@array@fosstodon.org avatar

@ntha @hydrian @blu256 No, my models declare the attributes (mapped to the database ones), with constructors and getters/setters. That way I can pass the model objects through, for example, factories and interfaces (I use generics) up to the views. In this I was clearly "inspired" by the way say Laravel implements the MVC model. I'm just a noob so take this with a grain of salt, I'm probably doing more than one thing wrong or at least, not the best way possible. ;)

andrewfeeney,
@andrewfeeney@phpc.social avatar

and folks, what do you make of this?

https://youtu.be/kQdRT2odUIk

j3j5,
@j3j5@hachyderm.io avatar

@andrewfeeney this was my conclusion yesterday after checking around, basically, upgrade glibc everywhere!

https://hachyderm.io/@j3j5/112311386903090357

mergy,
@mergy@self.social avatar

@andrewfeeney Workaround possibly for now >> GLIBC Vulnerability on Servers Serving PHP https://mer.gy/iconvglibcvuln (via Rocky Linux)

"First, let us check if the system has the compromised set, running

iconv -l | grep -E 'CN-?EXT'

If there is no output, the system is safe to this vulnerability."

Else -

Browse to /usr/lib64/gconv/gconv-modules.d

Edit gconv-modules-extra.conf

Go to line 1254 and comment out the following..."

ctietze,
@ctietze@mastodon.social avatar

A question for more experienced developers than me:

We have this setup where all requests go through a PHP script for authorization (think: cookie) checking before serving files.

That's fine with HTML, but less ideal for 5MB PDFs.

I'm trying to search for ways to use PHP to allow/deny access, but otherwise let the web server (Apache) do its job.

Is there such a facility to rewrite requests for auth, but then go on serve the static files?

Crell,
@Crell@phpc.social avatar

@ctietze @joby @deanatoire Pretty sure yes. If you wanted to do that, there's some complex and rarely used HTTP headers that you'd have to handle manually, then work on the streams yourself. That would definitely be slower, but assuming my benchmarks are still vaguely correct, it wouldn't be orders of magnitude slower.

Unless that's a common issue for your use case, it's probably not worth the trouble.

Crell,
@Crell@phpc.social avatar

@ctietze 12 YEARS and you're the first person to spot that... Humans really are bad at proof reading. 🙂

Fixed now, thanks.

ramsey,
@ramsey@phpc.social avatar

Who will I see at next week? I’m giving a keynote on Thursday, and I’m super nervous. It’s only the second keynote I’ve ever given, and the first one was over 10 years ago. 😬😰

omnicolor,
@omnicolor@phpc.social avatar

@awoodsnet I would have loved to attend both, but some jerk is speaking at the same time as your first one, and I gotta attend that one. Looking forward to the dotfiles talk though!

sarah,
@sarah@phpc.social avatar

@ramsey I’ll be there! My whole team is coming.

noidea,

Hello ..

Today I installed 8.3 on my VServer ( Linux) and tried to switch to that version with ln -fs /usr/bin/php83 /usr/bin/php .
Previously I used php 8.2.x

The problem is, 's Admin Page says this:

version 8.2.18
php.ini /etc/php82/php.ini

and in SSH, the php --version command says that:

PHP 8.3.6 (cli) (built: Apr 11 2024 15:12:15) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.3.6, Copyright (c) Zend Technologies

The phpinfo() included in the admin area also says 8.2.18 and I have deleted the php-fpm82 service and added and started the php-fpm83 service and also restarted the php and apache and mariadb services and rebooted the server..

Has somebody got an idea what I am missing?

hypolite,

@noidea I've always used Apache2 with the PHP module because of the reduced amount of moving parts, and many Friendica administrators have had success serving their node using php-fpm and nginx as a web server/reverse proxy.

I read it's possible to use Apache and php-fpm together, but it isn't a very popular use case and I wouldn't be able to recommend it.

noidea,

It seems okay now.

This message :

[Wed May 08 17:36:06.972634 2024] [so:warn] [pid 13101] AH01574: module php_module is already loaded, skipping

Led me to uninstalling the package php82-apache2 , which seemed to be still loaded. After that the other one (php83-apache2) seemed to be in use. (maybe some "reload" would have helped, too, i don't know..)
Then I had to install php83-session to be able to log in.
Now it looks okay in the admin page:

version	8.3.6
php.ini	/etc/php83/php.ini

thanks.

And the php-fpm packages are now removed..

ramsey,
@ramsey@phpc.social avatar

I was looking at this Sass (SCSS) compiler, written in , and I noticed something very odd.

Under “requires (dev)," it requires two packages, sass/sass-spec and thoughtbot/bourbon, both of which appear to be empty packages, containing only a composer.json file, which has no dependencies.

What’s the purpose of these packages? They otherwise appear suspicious, to me, but I can’t see that they're doing anything nefarious right now—they just appear pointless.

https://packagist.org/packages/scssphp/scssphp

asjmcguire,
@asjmcguire@mastodon.scot avatar

@ramsey well sass/sass-spec is supposed to a package that ensures that sass compiles properly. https://github.com/sass/sass-spec and the other one is sass related too https://github.com/thoughtbot/bourbon so neither should be empty.

naderman,
@naderman@phpc.social avatar

@ramsey @seldaek that's a bit of a shortcoming in packagist.org we should probably address. scssphp composer.json actually contains a custom package repository definition which defines thoughtbot/bourbon has something that doesn't exist on packagist.org and because it's only in require-dev which is only loaded from root composer.json, that means that custom definition will always be used, and never the package that's linked to on packagist.org.

Crell,
@Crell@phpc.social avatar

Please, web app developers, consider how your users will upgrade. If your upgrade process is "remove the old one, unzip the new one", then it's not an upgrade process. It's an encouragement to never upgrade.

qrazi,
@qrazi@phpc.social avatar

@Crell @acelaya I've used Ansistrano - https://ansistrano.com/ - for a few projects, that run on small vps', to automate steps I used to do manually. Not sure if applicable to this question though 😅

bobmagicii,
@bobmagicii@phpc.social avatar

@Crell remove the old one?!?!?!? i shout yolo unzip that shi on top boiiiiiiiiiiiiii 🤣 🤣 🤣 🤣

Crell,
@Crell@phpc.social avatar

Proposal for a conference talk: How to configure and all its tooling extensions (xdebug, phpstan, php-cs-fixer, etc.) to use a docker container consistently.

That could easily fill a tutorial...

heiglandreas,
@heiglandreas@phpc.social avatar

@Crell @alessandrolai The "use relative paths" usually is what makes it a tad more complex for me than it should be. Though it is expected 🙈

alessandrolai,
@alessandrolai@phpc.social avatar

@herndlm @Crell no you can't. Other IDEs like VS code solve the issue with dev containers, basically running the IDE from the inside of Docker.

I have many colleagues with Macs and they all solved the performance issues with some tool, but I don't know how.

Crell,
@Crell@phpc.social avatar

This looks very interesting...

https://github.com/extism/php-sdk

pronskiy,
@pronskiy@phpc.social avatar

@Crell It’s similar to Wasmer https://github.com/wasmerio/wasmer-php, but they use FFI i.e. there is no need to install extension , right?

Crell,
@Crell@phpc.social avatar

@pronskiy I dunno. My knowledge is limited to what's in the Readme. :-)

Its apparently a common Wasm runtime for several languages. I don't know if it's wasmer or wasmtime under the hood.

ollieread,
@ollieread@phpc.social avatar

I need to remember that Mastodon exists! I’m currently writing a bunch of content to do with PHP and this would be the perfect place to talk about that.

I’m currently trying to decide whether is an interesting enough topic that people may like an in-depth course/series on it. It seems to be something a lot of people are vaguely aware of, but don’t really know the details.

ollieread,
@ollieread@phpc.social avatar

I’ve also been trying to put together some content that’s more beginner friendly, by researching frequently searched queries on Google.

These are the ones I have so far.

ollieread,
@ollieread@phpc.social avatar

In fact, this is my first draft of the article on covariance and contravariance as concepts but also related to .

I've tried to go for simple, without too many details, but I think this contains the fewest number of details I'm capable of writing 😂

https://gist.github.com/ollieread/273cf344503533ee4c497ab4c62929bf

itsjoshbruce,
@itsjoshbruce@phpc.social avatar

It’s been so long since I did anything with authenticated users, curious about “modern” patterns and standards.

Specifically, an authenticated user wants to do something. What patterns and standards are you using for permissions?

I’m seeing middleware mentions. But, curious what else is out there. Not looking for “use Framework X” and should be testable. Doesn’t need to be web-specific as I’m just looking for patterns and standards.



itsjoshbruce,
@itsjoshbruce@phpc.social avatar

@oliver: Right in. Is it the user or the request falling through the middleware checks?

oliver,
@oliver@phpc.social avatar

@itsjoshbruce it's the request (route or route group middleware). Authenticated user is set early to the container and then various areas are protected based on the user's roles. Of course, there are more detailed checks later in the flow (e.g. parts of the interface are hidden or different depending on role/permissions). Middleware is stopping the unintended actions, like playing with URLs to access what's not supposed to be seen or actioned on.

sarah,
@sarah@phpc.social avatar

What do you use for offsite backups for applications and databases?

willpower232,
@willpower232@phpc.social avatar

@mwop oh that's clever, I keep forgetting about fuse, are you using this one? https://github.com/s3fs-fuse/s3fs-fuse?tab=readme-ov-file

mwop,
@mwop@phpc.social avatar

@willpower232 Yes, within a container, via elementary/s3-volume (https://github.com/elementar/docker-s3-volume).

phpday,
@phpday@phpc.social avatar

⭐️ "Watch the clock" is Andreas Heigl's talk.
@heiglandreas is Solution-Provider

#phpday #phpday #PHP #conference

MarkBaker,
@MarkBaker@phpc.social avatar

@Crell @phpday @heiglandreas it isn't the first time that a phpday talk has been presented in a kilt

Crell,
@Crell@phpc.social avatar

@MarkBaker @phpday @heiglandreas The one year I was there, it was sadly kilt-free.

menelion,
@menelion@dragonscave.space avatar

Dear community! Could someone with power please raise an RFC to make the strict parameter of the in_array() built-in function true by default? It's really annoying to remember putting true as the third parameter every time, and not doing it might potentially lead to weird bugs. Thanks!

menelion,
@menelion@dragonscave.space avatar

@ntha Unfortunately, it's a super old frameworkless codebase. Imagine that I have to bring it from 5.6 straight to 8.2.

menelion,
@menelion@dragonscave.space avatar

@Yinshi Да я вообще не понимаю, что это блин такое. То есть оно в массиве, но не совсем, потому что '1' == 1. Аррргх! К счастью, теперешний PHP всё же по большей части, что называется, здорового человека, но вот такие штуки прям выбешивают иногда.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • php
  • kavyap
  • InstantRegret
  • ethstaker
  • DreamBathrooms
  • mdbf
  • magazineikmin
  • thenastyranch
  • Youngstown
  • tacticalgear
  • slotface
  • Durango
  • khanakhh
  • rosin
  • everett
  • Leos
  • vwfavf
  • normalnudes
  • osvaldo12
  • cubers
  • GTA5RPClips
  • cisconetworking
  • ngwrru68w68
  • anitta
  • provamag3
  • tester
  • modclub
  • megavids
  • JUstTest
  • All magazines