Compiling PHP with MySQLi Built in Windows 7

I am trying to determine if MySQL, which is built into PHP, can be used in a Windows 7 environment. The PHP manual indicates that the MySQLi extension has the ability to start and stop the embedded MySQL server.

However, distributed assemblies for Windows using PHP.net do not seem to be included. My Internet searches showed me this question: Compiling PHP with --enable-embedded-mysqli and -with-mysqli , which seems to indicate that if I compile PHP, I can enable MySQL server built-in commands.

While I can successfully build vanilla PHP, I seem to be unable to get buildconfto provide an configureoption --enable-embedded-mysqli. Can anybody help me?

+4
source share
1 answer

So, after extensive research and testing, I found a solution

Compiling PHP on windows is based on config.w32 files to provide the configure and make file with the necessary instructions for setting up and compiling PHP. The Unix variant is the config.m4 file.

The problem is that the Windows variable has no logic to activate the embedded server.

Original code (only part of interest)

if (CHECK_LIB("libmysql.lib", "mysqli", PHP_MYSQLI) &&
    CHECK_HEADER_ADD_INCLUDE("mysql.h", "CFLAGS_MYSQLI", PHP_MYSQLI + 
                                        "\\include;" + PHP_PHP_BUILD +
                                        "\\include\\mysql;" + PHP_MYSQLI)) {
    EXTENSION("mysqli", mysqli_source);
    AC_DEFINE('HAVE_MYSQLILIB', 1, 'Have MySQLi library');
    MESSAGE("\tlibmysql build");
    PHP_INSTALL_HEADERS("ext/mysqli", "php_mysqli_structs.h");
} else {
    WARNING("mysqli not enabled; libraries and headers not found");
    PHP_MYSQLI = "no"
}

You need to change this code to provide an embedded server.

if (PHP_EMBEDDED_MYSQLI != "no") {
    if (CHECK_LIB("libmysqld.lib", "mysqli", PHP_MYSQLI) &&
        CHECK_HEADER_ADD_INCLUDE("mysql.h", "CFLAGS_MYSQLI", PHP_MYSQLI + 
                                        "\\include;" + PHP_PHP_BUILD +
                                        "\\include\\mysql;" + PHP_MYSQLI)) {
        EXTENSION("mysqli", mysqli_source);
        AC_DEFINE('HAVE_MYSQLILIB', 1, 'Have MySQLi library');
        MESSAGE("\tlibmysql build");
        AC_DEFINE('HAVE_EMBEDDED_MYSQLI', 1, 'Embedded MySQL support enabled');
        MESSAGE("\tEmbedded MySQL build");
        PHP_INSTALL_HEADERS("ext/mysqli", "php_mysqli_structs.h");
    } else {
        WARNING("mysqli not enabled; libraries and headers not found");
        PHP_MYSQLI = "no"
    }
} else {
    if (CHECK_LIB("libmysql.lib", "mysqli", PHP_MYSQLI) &&
        CHECK_HEADER_ADD_INCLUDE("mysql.h", "CFLAGS_MYSQLI", PHP_MYSQLI + 
                                        "\\include;" + PHP_PHP_BUILD +
                                        "\\include\\mysql;" + PHP_MYSQLI)) {
        EXTENSION("mysqli", mysqli_source);
        AC_DEFINE('HAVE_MYSQLILIB', 1, 'Have MySQLi library');
        MESSAGE("\tlibmysql build");
        PHP_INSTALL_HEADERS("ext/mysqli", "php_mysqli_structs.h");
    } else {
        WARNING("mysqli not enabled; libraries and headers not found");
        PHP_MYSQLI = "no"
    } 
}

ARG_WITH().

ARG_ENABLE("embedded-mysqli", "Enable the embedded mysqli server", "no");

buildconf mysqli configure.

configure --with-extra-includes=[path-to-mysql-dir\include] --with-extra-libs=[path-to-mysql-dir\lib] --without-mysqlnd --with-mysqli=shared,libmysqldclient --enable-embedded-mysqli [other options here]

nmake nmake snap PHP:)

libmysqld.dll C:\mysql\php ( php). php php.ini, .

PHP nmake snap , PHP, php-, MySQLi , mysql , ( ), .

mysql (my.ini) php.exe. , , PHP mysql. [embedded], [mysqld] .

, , , my.ini , PHP. MySQL , .

+1

All Articles