PHP 7 MySQL functions

Материал из Webko Wiki
Версия от 09:59, 26 января 2016; Sol (обсуждение | вклад) (Новая страница: «Категория:WebКатегория:DB Simply compile the mysql function as a php pecl extension and add one line to your php.ini First get the mys…»)
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
Перейти к навигации Перейти к поиску


Simply compile the mysql function as a php pecl extension and add one line to your php.ini

First get the mysql extension source which was removed in March: https://github.com/php/php-src/tree/PRE_PHP7_EREG_MYSQL_REMOVALS/ext/mysql

Either:

git clone https://github.com/php/pecl-database-mysql     mysql   --recursive

or

svn co https://github.com/php/php-src/tags/PRE_PHP7_EREG_MYSQL_REMOVALS/ext/mysql mysql 

or

http://pecl.php.net/package/mysql

(same code, same timestamp, now static and likely will never be updated again) Then compile the code on your server:

phpize
./configure
make
make install

The “make install” should announce where it is copying mysql.so – copy that path. It will likely be /usr/local/lib/php/extensions/no-debug-non-zts-20141001/ for PHP 7 but it could vary depending on your server setup.

Then edit your php.ini Somewhere either in the “Extensions” section or “MySQL” section, simply add this line:

extension = /usr/local/lib/php/extensions/no-debug-non-zts-20141001/mysql.so

(change path if needed)

Restart PHP and mysql_* functions should now be working again. Check your php error log if you have any problems (should check it periodically anyway). You will also see the MySQL section back in your phpinfo page.