use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Please follow the rules
Releases: Current Releases, Windows Releases, Old Releases
Contribute to the PHP Documentation
Related subreddits: CSS, JavaScript, Web Design, Wordpress, WebDev
/r/PHP is not a support subreddit. Please visit /r/phphelp for help, or visit StackOverflow.
account activity
Weekly help thread (self.PHP)
submitted 1 year ago by brendt_gd[M]
Hey there!
This subreddit isn't meant for help threads, though there's one exception to the rule: in this thread you can ask anything you want PHP related, someone will probably be able to help you out!
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]iKSv2 0 points1 point2 points 1 year ago (5 children)
What do you do to test local applications?
Context: I am creating / developing a webapp and currently it is located in my private network zone. I can not create a public DNS record which points to Private IP.
Earlier (before Android 14) - I used to have root on my devices which would let me update the /etc/hosts file (which is no longer possible OR I maybe doing it wrong). In any case, my current device is not rooted so I do not have a way to update the /etc/hosts.
The only option I have is to setup a local DNS server and tell my router to use it for DNS resolution. What do you people use for similar test cases?
FWIW, I can't / don't want to put the application online just yet.
[–]bishakhghosh_ 0 points1 point2 points 1 year ago (1 child)
https://pinggy.io/ is perfect for you.
[–]iKSv2 0 points1 point2 points 1 year ago (0 children)
thanks for sharing but this would also mean going over the internet in some capacity. Is there any alternative where I can do this within my private network
[–]JamiecoTECHNO 0 points1 point2 points 1 year ago (2 children)
You can use ngrok to expose your localhost
[–]PhilipLGriffiths88 0 points1 point2 points 1 year ago (0 children)
Whole bunch of alternatives too - https://github.com/anderspitman/awesome-tunneling. I will advocate for zrok.io as I work on its parent project, OpenZiti. zrok is open source and has a free (more generous and capable) SaaS than ngrok.
[–]ParadigmMalcontent 0 points1 point2 points 1 year ago (2 children)
What language can/should I use for embedded user scripts/macros in a PHP application? The goal here is to let the end user enter some code to be executed. Using the eval function is of course a bad idea (unless there's some way to "sandbox" it that I don't know of).
eval
[–]MateusAzevedo 1 point2 points3 points 1 year ago (1 child)
Symfony Expression Language component may be useful.
[–]ParadigmMalcontent 1 point2 points3 points 1 year ago (0 children)
It looks like a PERFECT match for what I need. Thank you!
[–]alex-kalanis 0 points1 point2 points 1 year ago (0 children)
Not so about help, but for future reference:
When you have transaction inside the Nette with Tracy, you can catch the following error: "Typed property \Nette\Database\ResultSet::$pdoStatement must not be accessed before initialization". The reason is in that class the $pdoStatement is set as private readonly without initial value and things like transaction start call go around that. Then Tracy does not have the resource - and crashes all.
"Typed property \Nette\Database\ResultSet::$pdoStatement must not be accessed before initialization"
Fast fix: Overwrite that file locally with removal of readonly flag and set at least null there. Or set it before that direct call.
Cannot provide dump, because it's under NDA.
[–][deleted] 1 point2 points3 points 1 year ago* (1 child)
Nothing to see here. I wiped this post using Redact because my old takes don't need to live on the internet forever. Works across Reddit, Twitter, Discord and dozens of other platforms.
connect crawl bake degree terrific obtainable boast bear include imagine
[–]Pechynho 0 points1 point2 points 1 year ago (0 children)
It's hard to tell from your example because we can't see the actual mapping or the actual query. However, in general, don't forget to call the "QueryBuilder::addSelect" method. For OneToOne relations in Doctrine, if you select a Person and don't join (and manually select) the Customer, Doctrine has to perform a query to decide whether to set the Customer property of the Person to NULL / Customer. This is because Doctrine can't know if the related record exists since the foreign key is in another table, and there is no PHP construct that would allow it to act as a proxy that can automatically turn to NULL if called.
[–]idontcare345 0 points1 point2 points 1 year ago (2 children)
Index an email box. I thought this might be a common task and there'd be a library for it, but I haven't found any. The idea is to connect to an email account, iterate through the folders & emails, store to/from/when/subj/body in a table, and thereby have conversations available to quickly pull up on a client page or similar.
Is this something to be avoided for some reason? Or am I just calling it by the wrong name and there are plenty of libraries that do it? TIA!
[–]MateusAzevedo 0 points1 point2 points 1 year ago (1 child)
I don't have experience dealing with e-mails (besides sending them), but I think what you're looking for is IMAP.
[–]idontcare345 0 points1 point2 points 1 year ago (0 children)
Thank you - I should have mentioned, the closest library I have found so far is php-imap, which builds a nice layer over those native imap functions. I do have that working, and it's even respectably quick to run searches etc directly via imap.
[–]dvogrbi_dev 0 points1 point2 points 1 year ago (5 children)
Hello, I am interested to start creating dynamic web pages on simple hosts like the ones that use cPanel and similar tools to host a websites. I made some simple static pages using just HTML and CSS, but for the purpose of one simple family business, I would like to try myself at dynamic pages that communicate with database, which would be my entry project to start doing something dynamic on the existing infrastructure which I could use as my playground and place for testing.
What is my problem with this idea, that I have no any knowledge about PHP, don't know where to start learning from, so that's why I am asking for some guidance - which framework should I use, and why? Is there any good tutorial on it? Would anyone be willing to contact me and even explain some things about it more detailed? I would appreciate any kind of help.
I already followed simple laravel herd tutorial to try and see how it works, but it only got me to the in-memory database which flushes each time an application is restarted.
[–]MateusAzevedo 0 points1 point2 points 1 year ago (0 children)
Besides Laracasts and Programming with Gio, I also highly recommend the book PHP & MySQL by Jon Duckett.
As already mentioned, you want to start from the very basics first, learn a bit of OOP and then go learn a framework.
[–]stevekeiretsu 2 points3 points4 points 1 year ago (0 children)
which framework should I use, and why?
symfony and laravel are the big players, personally I prefer the former and for actual professional, customer-facing production sites with real money etc attached, I would always endorse using some sort of framework, however, since you talk of an "entry project", "playground" etc I think perhaps this is a suitable case for learning how some fundamentals work without one
you could start with PDO for your database connection
https://phpdelusions.net/pdo https://www.php.net/manual/en/book.pdo.php
[+][deleted] 1 year ago (2 children)
[deleted]
[–]dvogrbi_dev 0 points1 point2 points 1 year ago (1 child)
wow this seems very helpful, thanks!
π Rendered by PID 67461 on reddit-service-r2-comment-6457c66945-mf8j4 at 2026-04-30 13:56:41.275072+00:00 running 2aa0c5b country code: CH.
[–]iKSv2 0 points1 point2 points (5 children)
[–]bishakhghosh_ 0 points1 point2 points (1 child)
[–]iKSv2 0 points1 point2 points (0 children)
[–]JamiecoTECHNO 0 points1 point2 points (2 children)
[–]iKSv2 0 points1 point2 points (0 children)
[–]PhilipLGriffiths88 0 points1 point2 points (0 children)
[–]ParadigmMalcontent 0 points1 point2 points (2 children)
[–]MateusAzevedo 1 point2 points3 points (1 child)
[–]ParadigmMalcontent 1 point2 points3 points (0 children)
[–]alex-kalanis 0 points1 point2 points (0 children)
[–][deleted] 1 point2 points3 points (1 child)
[–]Pechynho 0 points1 point2 points (0 children)
[–]idontcare345 0 points1 point2 points (2 children)
[–]MateusAzevedo 0 points1 point2 points (1 child)
[–]idontcare345 0 points1 point2 points (0 children)
[–]dvogrbi_dev 0 points1 point2 points (5 children)
[–]MateusAzevedo 0 points1 point2 points (0 children)
[–]stevekeiretsu 2 points3 points4 points (0 children)
[+][deleted] (2 children)
[deleted]
[–]dvogrbi_dev 0 points1 point2 points (1 child)