php

This magazine is from a federated server and may be incomplete. Browse more on the original instance.

Olissipo, in Should I create functions for packages/libraries that allow optional parameters to accept null as a value?
@Olissipo@programming.dev avatar

As long as optional parameters are placed last, I don’t see why not.

PHP8’s named parameters lessen the pain of using a function with optional parameters spread around, but I still stick to that rule.

lens0021, (edited ) in PHP Release Cycle Update

btw my company uses PHP 5.5

phirdowak, in PHP Release Cycle Update

Still rocking PHP 7.2 over here \m/ Will take some time before I can start to appreciate this change

henfredemars, in Nasty bug with very simple exploit hits PHP just in time for the weekend

I love a good, simple logic bug.

thebardingreen, in Nasty bug with very simple exploit hits PHP just in time for the weekend
@thebardingreen@lemmy.starlightkel.xyz avatar

Me (who admins a BUNCH of self hosted PHP stuff for myself and clients and for my consulting team’s internal use): Oh shit!

Also Me: Meh, only affects Windows.

Olissipo, in Symfony 7.1.0 released (Symfony Blog)
@Olissipo@programming.dev avatar

I particularly like the new Mapped Route Parameters.

/show/{id}/

/show/{id:document}/

For multiple entities, it’s cleaner and more beginner-friendly than using the #[MapEntity] attribute (which is still an option).

And imo it’s a good move to deprecate “not passing the mapping” even for single entities. With the mapping the behaviour is more intuitive and “feels” less magic.

tsonfeir, in Why PHP Usage Has Declined by 40% in Just Over 2 Years
@tsonfeir@lemmy.world avatar

PHP is great when you use it right. The problem is, most people don’t use it right. That old way of rendering html through PHP, or worse, injecting PHP into html, is antiquated.

IMO, PHP is a great language to use for making your backend API. Use whatever flavor of the week on your front end.

Olissipo,
@Olissipo@programming.dev avatar

Aren’t you only saying, indirectly, that server-side rendering is “antiquated”?

Unless you mean that mixing logic with templates is bad, in which case I agree.

tsonfeir,
@tsonfeir@lemmy.world avatar

Well, both?

There’s always a use for server rendered html. Maybe JavaScript is an issue. But it’s usually not. The list is pretty short though.

I can’t think of many situations where I would say yes if I asked myself “if you could re-do the system today, would you still choose server-rendered html?”

I’m sure other people have use cases where it would make sense. I build admin utilities and ERP stuff.

Olissipo,
@Olissipo@programming.dev avatar

That’s a valid opinion. And I admit that at some point you must move to some form of client-side rendering.

I still haven’t (for some admin panels too, and websites), so I don’t feel the need to switch.

tsonfeir,
@tsonfeir@lemmy.world avatar

Well, if it ain’t broke, and you’re not getting paid to refactor it, don’t fix it.

spartanatreyu, in Why PHP Usage Has Declined by 40% in Just Over 2 Years
@spartanatreyu@programming.dev avatar

TIOBE index, literally in the first sentence…

PHP leaves a bad taste in my mouth and I’d be happier if we were rid of it (or it continued changing for the next 10 years), but even I can see this article is worthless.

shnizmuffin, in How do I create dynamic websites using PHP/javascript/HTML/CSS?
@shnizmuffin@lemmy.inbutts.lol avatar

Yes.

thesystemisdown, in Why PHP Usage Has Declined by 40% in Just Over 2 Years

That article makes little sense. There is not a non-php version of WordPress at this time. I know Gutenberg uses Node and NPM, but the heavy lifting is still PHP. There has always been client side scripting and server side scripting with WP. I’ll buy that devs are lobbying clients to use something else, but to say this is because WordPress is driving the change can’t be right.

Emperor,
@Emperor@feddit.uk avatar

That article makes little sense.

Yes, they seem to have WP blinkers on.

It is far more likely that this is from the rise of “sexier” server-side coding languages like Rust. Now I don’t know much about Rust (although I will look into it more) but I a bit of Googling on Rust vs PHP a while back and PHP is still a solid choice for a lot of things and there seem to be a lot more people out there who can code in it, making it a.good choice for FOSS projects.

TWeaK, in Why PHP Usage Has Declined by 40% in Just Over 2 Years

I hate JavaScript, along with the whole of web 2.0 and moving shit around as it loads, making the user wait to input rather than taking the input and processing as quickly as possible, and in general the whole theme of software no longer being designed for the user to use but for the publisher to extract value from the user.

monomon, in I have suddenly inherited a PHP project. What VSCode extension or server is best for developing it locally? I’m down with any other suggestions too!
@monomon@programming.dev avatar

ddev saved my life when I inherited a drupal project.

dbx12, (edited ) in Help installing PHP on Ubuntu (Solved. Thank you!)

Looks like your php code is wrong, try this (and just this) for index.php


<span style="color:#323232;"><?php
</span><span style="color:#323232;">phpinfo();
</span>

You also had Test Text1 inside the php block which is a syntax error. Maybe that’s the cause why you don’t get anything.

Edit corrected the filename to lowercase extension.

GardenVarietyAnxiety,

I wiped and reinstalled everything php and apache… It still didn’t work, so I tried your suggestion and simply put

<?php phpinfo();

It works now? And reverting to my original file works too…

I don’t know how, but your idea worked. Thanks~

dbx12,

Great that it worked out, did you use apt remove or apt purge?

You might want to put your code in triple back ticks so it renders as code block :) Currently isn’t visible on some clients (boost for Lemmy in my case)

sloppy_diffuser, in Help installing PHP on Ubuntu (Solved. Thank you!)

I don’t have a solution, but wanted to comment this is a reason to use docker. Instead of tinkering with your host system in ways you’ll probably forget, declare all the steps in a nice containerized system that does one thing: hosts a php website as you develop.

Expose your project through a volume for a mostly seamless file sharing experience between the host and container.

GardenVarietyAnxiety,

I’ve seen a lot about docker, and it looks pretty awesome.

I’ll definitely get to it eventually, I’m just trying to learn the basics for now.

hitmyspot, in Help installing PHP on Ubuntu (Solved. Thank you!)

Have you tried a html file to ensure Apache is ok? Or no files and Apache should show a server page.

Also, the test file can just be

<?php phpinfo(); ?>

GardenVarietyAnxiety,

I wiped and reinstalled everything php and apache… It still didn’t work, so I tried to simply put

<?php phpinfo();

as suggested by someone else …and it works now? I reverted my .php file to what I listed in my op and that works now, too.

Oi.

hitmyspot,

Lol, turn it off and back on!

GardenVarietyAnxiety,

Basically, lol

  • All
  • Subscribed
  • Moderated
  • Favorites
  • php@programming.dev
  • random
  • meta
  • Macbeth
  • All magazines