logs archiveIRC Archive / Freenode / #php / 2015 / July / 29 / 1
TML
sockets don't use FDs
kmq
hmm, I get 500s with the message "too many open files"if the file descriptor limit is at 1024
and that buffer overflow when I set the limit up to 2048
socket's don't use fd's? I thought, since they show up in lsof, they do ... hmm, you mean there could be another area where I am burning through fd's?
TML
yes
lsof doesn't limit itself to fd's
PHPGuy
Hello, How I have 2 arrays that I want to keep in sync. After I sort one how can I get the other array to correspond to the other array again. Example FruitsArray = {Apple, Pear, Orange} IDArray = {0, 1, 2) . FruitsArray Resorted is now FruitsArray = {Apple, Orange, Pear}. How can I resort IDArray to {0, 2, 1} if I don't know the data in either array?
TML
kmq: Are you using xdebug or xhprof?
kmq
xdebug ... ah, let me try without /me facepalms
TML
PHPGuy: FruitsArray = { [0, Apple], [1, Pear], [2, Orange] }
kmq
xdebug it is ...
oberststen
Hello, I'm trying to restart Apache using exec('service apache2 reload') in ubuntu, while using passthru I do get the "* Restarting apache server *" but it doesn't really restart it, anybody knows how to make it work?
         

TML
PHPGuy: http://3v4l.org/NAeUI
kmq
thanks, @TML
TML
oberststen: I would argue "Don't do that", personally.
oberststen
@TML: and what option do I have if I'm modifying Apache vhosts?
TML
oberststen: When you say "it doesn't really restart it", what does that mean?
oberststen: I mean, obviously it doesn't restart it - you issued "reload"
oberststen
@TML: reload it*, it doesn't load the new conf files
yeah, wrong word
it doesn't reload it
TML
oberststen: That's a known issue. You need restart.
However, I feel obligated to say that I find modifying vhosts and restarting Apache from inside PHP is a fundamentally bad idea.
delboy1978uk
restarting apache using exec? im not sure where to befgin..
oberststen
@TML: alright, thanks, and which function works better for this? exec, system, passthru? And yeah, the thing is that it is an automated system that adds new domains, what clean solutions would you recommend?
TheCowboy
Is there a best approach for if you want to be able to set a global config variable, but allow a function that uses that variable to be able to override it?
TML
oberststen: Ansible, Puppet, or Chef
delboy1978uk
why not write a cron job that checks for changes and then does whatever and restarts?
Alphos
oberststen if you're editing your vhost files, you clearly have shell access. why bother using php to reload/restart ?
TML
Alphos: He's saying that PHP modifies the vhosts
which...
Alphos
ewww
don't
just don't
ewww
delboy1978uk
lol
oberststen
Ok, alternatives?
TML
oberststen: I just gave you 3 major ones that are used by many different companies around the world
Alphos
oberststen : nano, vim, ed, emacs, echo >> + cat...
TML
don't modify the files on the host - modify the files in some other location, and use a configuration management system to deploy those and restart the correct services
         

Alphos
i'd go with "anything but php", but that would be a bit too inclusive
TML
TheCowboy: I would say that "have a function use a global variable" and "best approach" are diametrically opposed concerns, which makes the question a bit difficult at best
PHPGuy
Thanks TML! How does it work? :)
TML
PHPGuy: How does what work?
TheCowboy
TML, that's still a useful response, thanks
PHPGuy
TML: http://3v4l.org/NAeUI
TML
PHPGuy: What part of it do you need explained?
PHPGuy
TML: The Build Sorter Functions
*Functions
*Function
TML
PHPGuy: it takes an argument "$key" and generates a new function (closure) which will take two values, $a and $b, and sort them based on the case-insensitive version of the natural string sorting of the values in $a[$key] and $b[$key]
PHPGuy
TML: Thanks
tailgate
Are there some examples of good Autoloaders out there?
I'm realizing I screwed mine up as it tries to autoload phpunit classes even if I tell it to load from \
TML
tailgate: presuming I didn't believe that "autoloader" and "good" were mutually exclusive, I'd say look at the one ircmaxell wrote in his blog post at http://blog.ircmaxell.com/2012/07/is-autoloading-good-solution.html
PHPGuy
How can I sort an entire array by certain character positions? For instance how can I sort an array and omit searching on the first 3 characters?
*omit searching before a : is what I want to do
jj15
PHPGuy
So I want to nansort an array and omit all characters in the array elements that are in front of a :
sorabji
PHPGuy: have you tried usort?
PHPGuy
including the :
That's it
sorabji: No
sorabji: Thanks I will look into it :)
sorabji: I looked at usort on php.net but didn't see any options to set character positions for the array
sorabji
no, you pass it a function that will do the comparison how you want
PHPGuy
sorabji: Alright thanks :)
DissidentRage
today on r/lolphp https://threatpost.com/php-file-manager-riddled-with-vulnerabilities-including-backdoor/113969
TML
DissidentRage: not sure why that's an "lolphp" rather than an "lolpeopledostupidstufftotheircomputers"
DissidentRage
¯\_(Ä)_/¯
TML
why would anyone ever use something called "PHP File Manager"?
DissidentRage
"phpMyAdmin is fine, so I bet this is, too"
idk
Alphos
phpmyadmin is fine ? oh ?
DissidentRage
I'm not actually saying that
lol
TML
As long as it's clear that phpMyAdmin is NOT actually fine
PHPGuy
What's wrong with phpMyAdmin?
DissidentRage
(Action) uses Workbench/terminal binaries
TML
Besides the fact that it's a horrible idea, poorly implemented, with terrifyingly insecure defaults and little to no documentation explaining its weaknesses to its users?
ph88
what about http://www.adminer.org/ ?
fabienwang
TML, and what's the alternative when you have users who don't have an ssh access ?
TML
never heard of it
DissidentRage
getting a host that's not retarded
TML
fabienwang: Well, my personal choice historically has been "fix their SSH access"
I mean, it's not happened OFTEN that one of my clients lost their SSH access, but it's usually pretty easy to fix
fabienwang
well, as a hoster I can tell you I prefer let users play with their db in phpmyadmin than give them ssh (even if they'd be chrooted)
TML
*shrug* Agree to disagree, I suppose
jj15
DigitalOcean. Never had an issue with them. Lots of tutorials for begineers. And very cheap.
TML
I'm more of an AWS man myself, but DO is fine
PHPGuy
Hello how can I sort an array and without searching the first 3 characters of each element?
TML
PHPGuy: Use the code I already gave you but modify the sorting part to start at string index 2
PHPGuy
TML: Alright
PsychoBoB
likecolacola ??
PHPGuy
Must be PepSi
likecolacola
PsychoBoB: sup?
PHPGuy
TML: What does " return function ($a, $b) use ($key) " do?
TML
PHPGuy: it returns a function (more accurately, a closure)
PHPGuy
TML: What is $key?
I mean why did you pass in 1 for $key?
« prev 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 next »