logs archiveIRC Archive / Freenode / #php / 2015 / August / 12 / 1
ule
How can check if the code are really closing the PDO connection?
jonez
sc30317, check error_log
ule
pipe failed: too many open files in system
Connection failed with SQLite db : SQLSTATE[HY000] [14] unable to open database file
jonez
I would guess that a grep for "close" or whatnot would be a step in the right dir
sc30317
jonez:
jonez
you are likely using a poorly written framework
sc30317
yup:
PHP Catchable fatal error: Argument 1 passed to League\\CLImate\\Argument\\Parser::prefixedArguments() must be of the type array, null given
jonez
sc30317, does that help?
sc30317
jonez: not really
         

jonez
drat
you are closer in that you know where the error is... a method is getting a null when it expects an array
ule
the manual says that just setting the pdo handler to null should close the file
sc30317
yeah
jonez
ule, I would not do it that way
ule, explicitly call "disconnect" or "close"
ule, are you on a vm or a shared?
ule
jonez: not vm.. it's a linux box
jonez
ule, what cms/framework/etc?
ule
jonez: it's a cli script.. using pure PDO lib
jonez
what else is running?
ule
"To close the connection, you need to destroy the object by ensuring that all remaining references to it are deleted--you do this by assigning NULL to the variable that holds the object. If you don't do this explicitly, PHP will automatically close the connection when your script ends. "
got this from manual
jonez
ya I know about the manual
never leave anything to implicit behaviour
__adrian
jonez: **"PHP will automatically close the connection when your script ends"**
this is not "implicit."
it is well and explicitly defined
jonez
only if all refs are destroyed. I leave this to you, __adrian
ule
jonez: I believe I did something wrong.. because my code reads a .csv file and for each line it goes to the .sqlite3 file and try to read something
__adrian
jonez, "when your script ends".
ule
I'm openning one connection per line
jonez
__adrian, tell ule not me
__adrian
all objects behave this way, btw.
jonez
I bow to your wisdom.
ya, I thought that way about python, too. not the case. but whatever.
ule
__adrian: but I'm running a code that takes like 30 minutos to finish.. and I need to force the PDO clossing connection
__adrian
why? do you also keep opening new ones?
         

ule
that's the problem.. I don't need..
I'll fix it to open only once..
thanks!
__adrian
jonez, sorry, i thought this was your question.
jonez
__adrian, no.
ule
yeah.. but it's kind of weird to me.. because just destroying the object are not closing the file
or it takes time to close.. and the next loop interaction tryes to open the file again
__adrian
ule, even when all the references to the object are gone, this only *allows* the object to be garbage-collected. doesn't force it.
your code should not (have to) rely on an object being destroyed at any specific point.
ule
yeah
instead of passing the .sqlite3 path I'll pass the object to my methods
__adrian
*awesoem* !
ule
:)
__adrian
Dependency Injection
ule
get rid of this bad code
:)
__adrian
next thing i would ask is (you sure this really eneds to run for a half hour"
*needs
ule
yeah
maybe I'll need for hours
ph88
oh oh 1 billion composer packages installed soon
danrik
will PHP 7 finally allow us to run long-running PHP processes?
jbafford
danrik: youve been able to do long-running php processes for ages
sorabji
you can do it now, i just don't think it's a particularly good idea
jbafford
Ive had 5.3 and 5.4 running daemons with multi-year uptimes.
major issue with it has always been the memory management, and the memory manager has improved in every version
ule
jonez: fixed
jonez: thanks!
__adrian|afk: o/
danrik
jbafford: um. so can I write daemons just like those I can with python?
ule
danrik: I have one process here that runs for 24 hours..
jbafford
danrik: yes
ule
oh.. it's flying
Majeh
i've got a long running php process that's been up for 14 months now
that's the UAT, the production one's been up for 6 months
there's nothing wrong with using PHP in CLI as a daemon, if you know what you're doing
HHVM on the other hand...
that one sucks
ule
yeah..
I got a lot of problems of memory with doctrine.. but now it's fixed
Majeh
ule i use eloquent in my long running process, it turned out the dam thing kept a query log
or, better put - i didn't read sufficient docs :)
Sammitch
is there such a thing as a destructor for a static class?
DissidentRage
statics are forever
__adrian
Sammitch, since there is never a _construct_, what/how would a _destruct_ do/work?
DissidentRage
omg
<input type="text" id="signin" name="signin" id="signin-username"/>
why would you do this
__adrian
the question is WHY NOT would you do this
DissidentRage
drep meg pls
Sammitch
really I just want to flush some data out to disk when PHP shuts down
and I want this object to be static :I
__adrian
objects are never static. objects are always instances.
classes are static
DissidentRage
register_shutdown_function? :P
__adrian
why static?
Sammitch
__adrian: potato potato, you know what I mean.
__adrian
Sammitch, no, I'm pointing out something that lots of people get confused over.
including, possibly, you; given the question about destructors
Sammitch
I know it's a slightly stupid question, but it wouldn't be the first time PHP did something wacky
__adrian
not trying to be pedantic. it's a legitimate thing to understand.
« 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 next »