PHP

543 readers
1 users here now

Welcome to /c/php! This is a community for PHP developers and enthusiasts to share and discuss anything related to PHP. From the latest updates and tutorials, to your burning questions and amazing personal projects, we welcome all contributions.

Let's foster an environment of respect, learning, and mutual growth. Whether you're an experienced PHP developer, a beginner, or just interested in learning more about PHP, we're glad to have you here!

Let's code, learn, and grow together!

founded 1 year ago
MODERATORS
1
8
submitted 1 month ago* (last edited 1 month ago) by [email protected] to c/php
 
 

I've been working on this on and off, could use some other eyes to help expand features, maybe some pull requests. Let me know what you think. I just uploaded version 0.0.12 and I am going to start working on 0.0.13. The CMS is built in a bundle, so that's where most of the features are. What I have linked here is the skeleton app, but installation is still beefy. Thanks everyone!

Edit: Forgot the link to the bundle https://github.com/SeleneSoftware/seleneCMSBundle

2
 
 

Should I create functions for packages/libraries that allow optional parameters to accept null?

In this example below, I set the 3rd and 4th parameter as null which will act as the default value.

myLibrary::myFunction(1, 7, null, null, true);

Or is this not a good way to go about creating functions for a package and therefore should not accept null as a parameter value.

myLibrary::myFunction(1, 7, false, 4, true);
3
4
2
submitted 3 months ago by prwnr to c/php
5
8
submitted 3 months ago by prwnr to c/php
 
 

I want to try to migrate from PHPStorm to VSCode, what plugins to get to have the experience similar? I mean the code inspections, renaming, usage etc. Will PHL Intelephense plugin be all I need to achieve this? with xdebug and phpunit plugins in addition to that, or there are some other plugins that make the transition better?

6
13
PHP 8.3.10 Released (www.php.net)
submitted 3 months ago by mac to c/php
7
8
5
submitted 4 months ago by mac to c/php
9
12
submitted 4 months ago by mac to c/php
10
4
submitted 5 months ago by mac to c/php
11
12
13
 
 

In conclusion, it is easy to see PHP in 2024 as the forgotten child of web development, while JavaScript is the most popular kid in class. Sadly for PHP, its decline in usage is unlikely to stop any time soon — why would it, when WordPress developers are busy adapting to a new JavaScript paradigm? But at least there is active development at the PHP Foundation.

14
1
submitted 7 months ago by mac to c/php
15
8
submitted 7 months ago* (last edited 7 months ago) by [email protected] to c/php
 
 

(I'm currently using Firefox 124.01 on Ubuntu 22.04.03 LTS) (My formatting is also givinge problems... I want to eat my own eyeballs out right now...)

I'm very new to Linux, and trying to get PHP installed, but it won't render anything...

Following this guide (https://ubuntu.com/server/docs/programming-php), I started with:

sudo apt update
sudo apt install apache2

Test Page Success!

So I continue with:

sudo apt install php libapache2-mod-php
sudo apt install php-mysql
sudo apt install php-cgi

Then:

sudo systemctl restart apache2.service

I write the following in /var/www/html/index.php:

<?php

phpinfo();

Test Text1

?>

Test Text2

I see "Test Text2" and nothing else. I see my PHP tags and their contents upon source inspection.

Then I perform the following:

apt list --installed | grep php
sudo apt purge php
apt list --installed | grep php (0 Results)

And try again:

sudo apt install php libapache2-mod-php
sudo apt install php-mysql
sudo apt install php-cgi

sudo systemctl restart apache2.service

No luck... Any ideas what's going on?

A little additional info:

~$ which php
/usr/bin/php
~$ php -v
PHP 8.1.2-1ubuntu2.14 (cli) (built: Aug 18 2023 11:41:11) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.2, Copyright (c) Zend Technologies
    with Zend OPcache v8.1.2-1ubuntu2.14, Copyright (c), by Zend Technologies
~$ apt list --installed | grep php

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

libapache2-mod-php8.1/jammy-updates,jammy-security,now 8.1.2-1ubuntu2.14 amd64 [installed,automatic]
libapache2-mod-php/jammy,jammy,now 2:8.1+92ubuntu1 all [installed]
php-common/jammy,jammy,now 2:92ubuntu1 all [installed,automatic]
php-mysql/jammy,jammy,now 2:8.1+92ubuntu1 all [installed]
php8.1-cli/jammy-updates,jammy-security,now 8.1.2-1ubuntu2.14 amd64 [installed,automatic]
php8.1-common/jammy-updates,jammy-security,now 8.1.2-1ubuntu2.14 amd64 [installed,automatic]
php8.1-mysql/jammy-updates,jammy-security,now 8.1.2-1ubuntu2.14 amd64 [installed,automatic]
php8.1-opcache/jammy-updates,jammy-security,now 8.1.2-1ubuntu2.14 amd64 [installed,automatic]
php8.1-readline/jammy-updates,jammy-security,now 8.1.2-1ubuntu2.14 amd64 [installed,automatic]
php8.1/jammy-updates,jammy-updates,jammy-security,jammy-security,now 8.1.2-1ubuntu2.14 all [installed,automatic]
php/jammy,jammy,now 2:8.1+92ubuntu1 all [installed]
/etc/apache2/mods-enabled$ ls
access_compat.load  authz_core.load  deflate.load  mime.load         php8.1.load      status.load
alias.conf          authz_host.load  dir.conf      mpm_prefork.conf  reqtimeout.conf
alias.load          authz_user.load  dir.load      mpm_prefork.load  reqtimeout.load
auth_basic.load     autoindex.conf   env.load      negotiation.conf  setenvif.conf
authn_core.load     autoindex.load   filter.load   negotiation.load  setenvif.load
authn_file.load     deflate.conf     mime.conf     php8.1.conf       status.conf
16
17
3
submitted 7 months ago by mac to c/php
18
3
submitted 8 months ago by mac to c/php
19
9
submitted 8 months ago by mac to c/php
20
4
submitted 8 months ago by mac to c/php
21
5
submitted 8 months ago by mac to c/php
22
17
submitted 8 months ago by mac to c/php
23
2
submitted 8 months ago by mac to c/php
24
8
PHP 8.2.16 Released (www.php.net)
submitted 9 months ago by mac to c/php
25
12
PHP 8.3.3 Released! (www.php.net)
submitted 9 months ago by mac to c/php
view more: next ›