Viewed   42 times

I've a website designed in php with mysqli (mysql - improved) extension. The phpinfo() page shows this:

./configure --disable-fileinfo --disable-phar --enable-bcmath --enable-calendar --enable-ftp --enable-gd-native-ttf --enable-libxml --enable-magic-quotes --enable-mbstring --enable-pdo=shared --enable-soap --enable-sockets --enable-wddx --enable-zend-multibyte --enable-zip --prefix=/usr --with-bz2 --with-curl=/opt/curlssl/ --with-curlwrappers --with-freetype-dir=/usr --with-gd --with-imap=/opt/php_with_imap_client/ --with-imap-ssl=/usr --with-jpeg-dir=/usr --with-kerberos --with-libdir=lib64 --with-libexpat-dir=/usr --with-libxml-dir=/opt/xml2 --with-libxml-dir=/opt/xml2/ --with-mcrypt=/opt/libmcrypt/ --with-mysql=/usr --with-mysql-sock=/var/lib/mysql/mysql.sock --with-mysqli=/usr/bin/mysql_config --with-openssl=/usr --with-openssl-dir=/usr --with-pcre-regex=/opt/pcre --with-pdo-mysql=shared --with-pdo-sqlite=shared --with-pic --with-png-dir=/usr --with-pspell --with-sqlite=shared --with-tidy=/opt/tidy/ --with-xmlrpc --with-xpm-dir=/usr --with-xsl=/opt/xslt/ --with-zlib --with-zlib-dir=/usr

Does this mean that mysqli extension is enabled in this configuration?

 Answers

5

Should the mysqli extension be enabled then on the very same phpinfo page a "MysqlI Support | enabled" table header should appear. Look for that:


If you want to find out in a script, look for a function specific for mysqli like mysqli_connect() and than check if it exists:

var_dump(function_exists('mysqli_connect'));

If this outputs FALSE, then it does not exists and it's highly likely that you can not use the module.

Wednesday, November 9, 2022
1

I went ahead and ran a test where one query uses a prepared statement, and the other builds the entire query then executes that. I'm probably not making what I'm wanting to know easy to understand.

Here's my test code. I was thinking prepared statements sort of held back execution until a $stmt->close() was called to optimize it or something. That doesn't appear to be the case though as the test that builds the query using real_escape_string is at least 10 times faster.

<?php

$db = new mysqli('localhost', 'user', 'pass', 'test');

$start = microtime(true);
$a = 'a';
$b = 'b';

$sql = $db->prepare('INSERT INTO multi (a,b) VALUES(?, ?)');
$sql->bind_param('ss', $a, $b);
for($i = 0; $i < 10000; $i++)
{
    $a = chr($i % 1);
    $b = chr($i % 2);
    $sql->execute();
}
$sql->close();

echo microtime(true) - $start;

$db->close();

?>
Sunday, November 6, 2022
1

This actually depends on the Mysql server. The default max size for all data combined in the entire query is 1mb. See: http://dev.mysql.com/doc/refman/5.1/en/packet-too-large.html

If your data combined is under that "max_allowed_packet" threshold, just use "s" for the binding type for any text field. Infact, you can usually get away with using "s" for any field type at all (date, float, etc).

If your entire entry combined that you want to insert is over 1mb (or whatever you reset it to) in length, you'll want to use mysqli_stmt::send_long_data method and the "b" binding type to send this particular field in chunks.

Wednesday, August 24, 2022
 
5

First try the bc extension. I believe that comes pre-installed on XAMPP. If that doesn't work, the requirements for GMP are here and the instructions are here.

Saturday, November 19, 2022
 
shadfc
 
5

That's because your code:

$rootNode = $treeBuilder->root('mw_menu'); 

$rootNode
    ->children()
    ->scalarNode('mw_menu')->defaultValue('')->end()
    ->end();

means that the config file should look like this:

mw_menu: 
    mw_menu: "some teststring" 

An example:

To be more specific, you need to adapt your code to whatever node you want. In general, people use a general root, like mw_menu, and then secondary value like database_driver in the following example:

$rootNode = $treeBuilder->root('mw_menu'); 

$rootNode
    ->children()
    ->scalarNode('database_driver')->defaultValue('orm')->end()
    ->end();

Which would then look like this in config file:

mw_menu: 
    database_driver: mongo_db
Tuesday, November 15, 2022
 
Only authorized users can answer the search term. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :