logs archiveIRC Archive / Freenode / #php / 2015 / September / 8 / 1
znf
Warning: mysqli_real_connect(): Headers and client library minor version mismatch. Headers:50543 Library:100021 in /home/zoso/www/wp-includes/wp-db.php on line 1452
Can I somehow turn off this warning? Just this warning!
sorabji
why are you getting that warning?
znf
sorabji, because my php was compiled with mysql and I'm using mariadb
sorabji
not possible to fix it?
znf
Oh, I guess switching to mysqlnd fixed it
zLouD
Hello
Can somebody help me understand php-fpm?
I've got php5.5-fpm running but would like to have another fpm-pool for php7
Any help is welcome
Max-P
zLouD: What do you not understand? To run PHP7 you'll have to run another, completely seperate php-fpm instance in another directory for them not to conflict with eachother
AliG1000
I am not certain where I am going wrong. I have this error message "Fatal error: Call to a member function fetch() on boolean" when I run this code: $last_id = $dbc->query($sql)->fetch(PDO::FETCH_ASSOC)['log_pdo_id'];
zLouD
Max-P: Can you get in more detail, what is needed to achieve that?
         

__adrian
AliG1000, it means $dbc->query($sql) returned a boolean (i.e., FALSE). http://php.net/pdo.query
zLouD
I already tried but it didn't work out for me
__adrian
you are chaining the method calls, so you have no opportunity to check if query() worked or not
AliG1000
hmm - so nothing was inserted?
__adrian
was it an INSERT statement?
bannakaffalatta
zLouD php5-fpm and php7-fpm are 2 completely different installs
AliG1000
yes
__adrian
why are you trying to fetch from an insert statement
there is nothing to fetch
AliG1000
because I want to get the last inserted id
__adrian
did you SELECT the last_insert_id ?
AliG1000
INSERT INTO (fields) VALUES (values) RETURNING log_pdo_id
I had assumed that I could use query to grab that log_pdo_id
__adrian
is this postgres
AliG1000
yes
__adrian
k, i don't know for sure then. but my guess is the query is failing, and you're getting FALSE.
AliG1000
you could be right - I'll look into it some more
__adrian
so, advice: either don't chain the methods, so you have an opportunity to check query()'s return value
AliG1000
word
__adrian
OR set PDO::ERRMODE_EXCEPTION so you'll get an exception when it fails, and you won't have to explicitly check.
AliG1000
like this: $dbc->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
zLouD
bannakaffalatta: okay, so what? What do you want to tell me ...
I need help to set this up
         

__adrian
AliG1000 you can set it on construct also, in the $options
Max-P
zLouD: What distro are you using?
zLouD
Ubuntu Server 14.04
i already compiled 7 as fpm binary
and setup the apache conf to use it
but i can't get to start it
bannakaffalatta
so something is wrong with the config, that's completely different than your original question when you didn't have it compiled and set up as a apache conf
MikeSeth
I'm getting signature errors from composer
local problem or something wonky on packagist side?
bannakaffalatta
zLouD is it on the same port or using the same socket as the php5-fpm?
zLouD
I can't start it
nor have i an idea how i shall do it
My question is: how do i setup this kind of thing
bannakaffalatta
sudo service php7-fpm start
zLouD
I don't have php7-fpm
I have compiled it myself as i said
So where shall i get the service file?
bannakaffalatta
zLouD looks like someone made one here https://gist.github.com/bjornjohansen/9555c056a7e8d1b1947d
just need to run php7-fpm and pass it the config for it it looks like
zLouD
bannakaffalatta: So basically all i need is to check fpm-checkconf and then phpfpm?
oste
anyone know how to speed up hhvm from the command line?
where should I put the command line only config?
Logicgate
oste, are you using FastCGI?
oste
yeah
ntarki
I have a session which starts. In the form.php I have a $_SESSION['bla']['boo']=something. I click on the button which is echoed after setting $_SESSION['bla']['boo']=something and it says $_SESSION['bla']['boo'] is not set. However if I refresh before pressing the button it works. Basically only the first time. It doesn't make any sense, any ideas?
otherj
sharing your code would probably make it easier for someone to help you
__adrian
ntarki, i think you might be confused about how php works. php happens FIRST, on the server. by the time any buttons are clicked, php is done and over with.
ntarki
i know how it works
it just doesn't save the SESSION
which i set
__adrian
that's just what it sounds like. share your code, and we can figure it out
ntarki
http://pastebin.com/KkEv9zci
__adrian
where are we talking about
ntarki
when the button on line 1097
is clicked, on the line 42 43 44 i get error that SESSION['multi'] is not set
__adrian
1097 seems to be dealing with a db result...? is it $_SESSION['multi']['random'.$i]=$result[$i]['char_name']; ?
ntarki
yes, if it set echo $_SESSION['multi']['random'.$i]; below that it gives the correct result
__adrian
i'm asking if that's the line you're takling about. right under "//Save into session so I call the fight"
?
ntarki
Yes that is the line
__adrian
that's where you get the "undefined index" warning?
ntarki
No the undefined index i get it on
Lines 42 43 44
__adrian
ok, those both have different conditions attached to them. "//If it was pressed prepare to call fight function" only runs if $_POST["fight{number}"] was set; "//Save into session so I call the fight" only runs if $_SESSION['fight']['status']==='off' and $random_players==='on'.
perhaps these conditions simply aren't happening at the same time.
as an aside, i would strongly encourage you to separate your code into work vs. output. mixing things up confuses your logic, and can lead to a lot of other problems too.
!+php first
php-bot
your PHP can be sorted into two categories: code which _does work_ (processing input, controller logic, database access, error handling, etc.), and code which _produces output_(echo, <?= $var ?>,plain <html>, etc.). _work_ goes FIRST. _output_ goes LAST. example: https://gist.github.com/adrian-enspired/9ed2542a695e2ebe30aa
ntarki
give me a minute
__adrian
ntarki moving various tasks into functions could also help clean things up, make it more obvious + maintainable
ntarki
when i load the page for the first time is the corner up, http://postimg.org/image/ar8siyikx/
I think it would be faster to redo the whole thing
__adrian
maybe, but you need to understand the problem first:
first time the page is loaded, $_SESSION is empty.
on :36 - :49, you're trying to use $_SESSION["multi"] without first checking if it exists.
instead, you're checking $_POST.
dunno what's happening with the others (they seem to be in different files), but probably a similar situation.
i like to recommend writing out the logic of your app first - no details, no code - kindof like you're writing an outline for an essay or bullet points for instructions.
then keep breaking each step into individual instructions. make up names for those instructions. then, once all of this is done, write functions with those names, and write code in them which does those things.
then you're done.
(well, ok, lies. then you test, then you degub.)
*debug
then at some point you die
ntarki
I created a new account and it works fine now, i don't even >.>
« prev 1 2 3 4 5 6 7 8 next »