# [SOLVED]PHP fails to update/insert to mysql

## mardicas

Hello,

i have an urgent problem. Suddenly php cant update/insert to mysql.

```
emerge -pv apache php mysql pecl-apc

[ebuild   R   ] www-servers/apache-2.2.9-r1  USE="ssl -debug -doc -ldap (-selinux) -sni -static -suexec -threads" APACHE2_MODULES="actions alias auth_basic auth_digest authn_anon authn_dbd authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock dbd deflate dir disk_cache env expires ext_filter file_cache filter headers ident imagemap include info log_config logio mem_cache mime mime_magic negotiation proxy proxy_ajp proxy_balancer proxy_connect proxy_http rewrite setenvif speling status unique_id userdir usertrack vhost_alias -asis -authn_alias -cern_meta -charset_lite -dumpio -log_forensic -proxy_ftp -substitute -version" APACHE2_MPMS="-event -itk -peruser -prefork -worker" 0 kB

[ebuild   R   ] dev-db/mysql-5.0.60-r1  USE="berkdb perl ssl -big-tables -cluster -debug -embedded -extraengine -latin1 -max-idx-128 -minimal (-selinux) -static" 0 kB

[ebuild   R   ] dev-lang/php-5.2.6-r7  USE="apache2 berkdb bzip2 cdb cgi cli crypt ctype ftp gd gdbm iconv mysql mysqli ncurses nls pcre posix postgres readline reflection session simplexml sockets spl sqlite ssl truetype unicode xml xmlreader zlib -adabas -bcmath -birdstep -calendar -cjk -concurrentmodphp -curl -curlwrappers -db2 -dbase -dbmaker -debug -discard-path -doc -empress -empress-bcs -esoob -exif -fastbuild -fdftk -filter -firebird -flatfile -force-cgi-redirect -frontbase -gd-external -gmp -hash -imap -inifile -interbase -iodbc -ipv6 (-java-external) -json -kerberos -kolab -ldap -ldap-sasl -libedit -mcve -mhash -msql -mssql -oci8 -oci8-instant-client -odbc -pcntl -pdo -pic -qdbm -recode -sapdb -sharedext -sharedmem -snmp -soap -solid -spell -suhosin -sybase -sybase-ct -sysvipc -threads -tidy -tokenizer -wddx -xmlrpc -xmlwriter -xpm -xsl -yaz -zip -zip-external" 0 kB

[ebuild   R   ] dev-php5/pecl-apc-3.0.19  USE="-mmap" 0 kB

```

Everything worked before. I am not sure what i did. But suddenly phpmyadmin couldnt update anything, all the websites on the server fail too. I already tried to reboot the server, no luck.

I have re emerged all the above packages, nothing. 

THe only thing i have changed recently is turning apc to enambled and enabling the useflag of mmap, but it worked with those setings before, but not anymore.

The only thing i came across was about "hardenedphp", but i cant find this useflag nowhere.

Theres also a bugreport, but it has no fix(i get the same error from phpmyadmin):

https://bugs.gentoo.org/147918

Apaches and mysql-s error logs are empty as well.

This is realy urgent, any help is welcome!

----------

## mardicas

I turned on php debugging and the only thing that appears is:

[19-Nov-2008 21:24:10] PHP Warning:  Unknown: 2 result set(s) not freed. Use mysql_free_result to free result sets which were requested using mysql_query() in Unknown on line 0

[19-Nov-2008 21:24:10] PHP Warning:  Unknown: 1 result set(s) not freed. Use mysql_free_result to free result sets which were requested using mysql_query() in Unknown on line 0

And lots of this, but this doesnt seem to have anything to do with the problem, or does it?

Well, i turned on mysql debuging, and i can clearly see that PHP get those updates to MySQL, but why wont mysql DO IT!

----------

## mardicas

Okay, this is WEIRD!

Just for fun i gave the database user ALL GLOBAL privileges and things started to moove.

How the F can mysql privileges go bad out of the blue???

And why is it not enough if i give premissions to a certain table???? here is something clearly wrong!

----------

## mardicas

This is geting more awkward after every second!

I wrote a small script just to test weather it workd or gives errors.

```
$query='INSERT INTO tipik_oigustype SET kirjeldus="what the" and nimi="bar"';

   mysql_query($query,$conn);

   echo mysql_error($conn);
```

It gives no errors and when i select the data then the newly inserted fields are empty or just 0. They are VARCHAR type, so this does not make any sense at all!

----------

## mardicas

Something VERY stupit!

I dont get it how someone could have let something like this into the stable:

Basically every $_POST thing was reset to 0!

http://pecl.php.net/bugs/bug.php?id=10715

----------

