mysql is not enabled in phpinfo() of php 5.3.1

前端 未结 5 505
滥情空心
滥情空心 2021-01-14 13:01

I am having apache 2.2.14, php 5.3.1 and mysql 5.1.43 installed on vista. I am trying since 2 days to configure php to have mysql enable on phpinfo().

  1. I modif
相关标签:
5条回答
  • 2021-01-14 13:20

    Make sure you've edited the right php.ini. In case of doubt

    <?php echo 'ini= "', get_cfg_var('cfg_file_path'), '"';
    

    will tell you which one is used by your php installation.

    Maybe php tried to load the php-mysql extension and failed because of additional dependencies. That would cause a startup error entry in the error.log.

    Which php-build do you use? The php-mysql extension can either use libmysql.dll as transport layer or the new mysqlnd (MySQL native driver) module. You've added c:\php to PATH. That's usually done in order to let windows find libmysql.dll (though it's not necessary, there are other methods which I prefer). If php-mysql depends on libmysql.dll and windows can't find it loading php_mysql.dll will fail.
    But if you're using the php.net build of php 5.3.1 the mysql module uses mysqlnd:

    Installation on Windows

    In the official PHP distributions from 5.3 onwards, MySQL Native Driver is enabled by default

    This module is built-in in the php.net build. You can test that by calling php -m in a command shell. It prints all built-in modules.

    0 讨论(0)
  • 2021-01-14 13:23

    Thanks a lot to the user who said that we have to move the file php.ini to the folder /bin of the Apache server. it resolves me the same problem after more than one week of trying failed methods.

    Of course we must uncomment in the file the two lines;

    ;extension=php_mysql.dll
    ;extensin_dir="ext"
    

    by removing the semi-colon (;) and by specifying the full path for the extension library php_mysql.dll rather than ext as follows

    extension=php_mysql.dll
    extensin_dir="c:\Apache22\php53\ext"
    

    For me I installed Apache in the folder c:\Apache22 and PHP in the folder c:\Apache22\php53, you must use your own values.

    NOTE: Because mysql_ functions like mysql_connect() become deprecated in PHP 5.5 and above, it is recommended to enable also the library php_mysqli.dll to use functions like mysqli_ (improved version of mysql_ functions). To do that it is simple, you just have to uncomment the line:

    ;extension=php_mysqli.dll
    

    in the file PHP.ini as follows:

    extension=php_mysqli.dll
    
    0 讨论(0)
  • 2021-01-14 13:29

    Update April 7, 2013. Installed Windows 8 on an i7 Quad, HT 8, 3.62GHz, 12GBRAM.. Installed the latest version of MySQL, got it functioning properly. Installed the latest version of Apache Web Server, got it functioning properly. Installed the latest version of PHP, got it functioning properly. MySQL could not connect to the database. The error message was "mysql_connect function undefined". I copied the modified php.ini file into the "C:\Program Files (x86)\Apache Software Foundation\Apache2.2\bin", and restarted Apache web server... then it all magically started working.!!! I hope this helps somebody with setting up their own Windows MySQL / PHP web server.

    0 讨论(0)
  • 2021-01-14 13:33

    put php_mysql.dll in the "c:\php\ext" directory (and keep the extension="php_mysql.dll" uncommented [without the leading ;])

    0 讨论(0)
  • 2021-01-14 13:35

    You have to edit php.ini and add/uncomment a line to import the php_mysql.dll extention. Search for ;extention=php_mysql.dll and remove the ;. If you find this line without the ; in front of it, you have another problem. If you don't find this line, add it without the ;.

    You can also try to put a \ after the extention path: extension_dir="c:\php\ext\"

    0 讨论(0)
提交回复
热议问题