Documente Academic
Documente Profesional
Documente Cultură
Home
C AT E G O R I E S
How to put MySQL functions back into PHP 7 ajax
bbPress
PHP 7 will go “release candidate” on August 20th 2015 which is very exciting because it will instantly be twice CSS
as fast as PHP 5.6 (and all previous versions). PHP7 gives HHVM a run for the money and takes 5 minutes to Firefox extensions
compile instead of hours for HHVM. Firefox fixes
free stuff
But there is a catch – if you have any legacy code that uses the mysql_* functions, they will stop working hardware
entirely in PHP 7. Not just a warning, not just deprecated, but gone, fatal. HHVM
javascript
However, it is easy to get them back without using a wrapper or modifying your code… linux
I wouldn’t plan on using this solution far past 2016 but it will keep your legacy code running in the meanwhile. mySQL
PHP
Simply compile the mysql function as a php pecl extension and add one line to your php.ini rambling
random stuff
First get the mysql extension source which was removed in March: random thoughts
https://github.com/php/php-src/tree/PRE_PHP7_EREG_MYSQL_REMOVALS/ext/mysql TalkPress
Uncategorized
Either: windows fixes
Wordpress beta
1 cd ext/
2 git clone https://github.com/php/pecl-database-mysql mysql --recursive WordPress Security
WP development
or WP fixes
WP performance
1 cd ext/
WP plugins
2 svn co https://github.com/php/php-src/tags/PRE_PHP7_EREG_MYSQL_REMOVALS/ext/m
WP security
or WP themes
http://pecl.php.net/package/mysql
(same code, same timestamp, now static and likely will never be updated again)
ARCHIVES
Then compile the code on your server:
Select Month
1 phpize
2 ./configure
3 make
4 make install
The “make install” should announce where it is copying mysql.so – copy that path. It will likely be
BLOGROLL
/usr/local/lib/php/extensions/no-debug-non-zts-20151012/ for PHP 7 but it could vary depending on your libertus
server setup.
Mark on Wordpress
Then edit your php.ini mysql dba Sherri
Somewhere either in the “Extensions” section or “MySQL” section, simply add this line:
Ryan Boren
1 extension = /usr/local/lib/php/extensions/no-debug-non-zts-20151012/mysql.so
Tempus Fugit Blog
(change path if needed)
Wordpress Podcast
Restart PHP and mysql_* functions should now be working again. Check your php error log if you have any WordPress.com
problems (should check it periodically anyway). You will also see the MySQL section back in your phpinfo
WordPress.org
page.
CSS Pile
http://php.net/manual/en/install.pecl.static.php
CSS Vault
Basically you put the mysql source under ext/mysql then clear out any existing configure in the php source CSS Zen Garden
root and force buildconf to make a new configure. Then compile php including –with-mysql on the ./configure
command line. list of galleries
Style Gala
Note that PHP 7 deprecates several other functions and is more strict about other things like classes, so you
may need to tune your log to be less harsh about warnings. Unmatched Style
1
Privacyerror_reporting
& Cookies: This site=uses
E_ALL & ~E_STRICT
cookies. & to
By continuing ~E_DEPRECATED
use this website, &you
~E_NOTICE
agree to their use.
Close and accept
To find out more, including how to control cookies, see here: Cookie Policy
MYSQL Follow
But don’t ignore the warnings entirely because “deprecated” will one day turn into completely missing and fatal mysql dba Sherri
like mysql functions.
Loading...
Like
PHP
2 bloggers like this.
Drupal Chix
PHPWomen
Related Scripty Goddess
How to build HHVM 3.8 on CentOS 7 WordPress 4.3 benchmark: HHVM 3.9 vs
In "WP performance" PHP 7.0
In "HHVM" W O R D P R E S S B E TA
How to manually install the Zend wordcamp 2006- what’s new in WP 2.1
Optimizer Plus Opcode Cache on PHP 5.4
In "PHP"
WP DEVELOPMENT
This entry was posted on August 6, 2015. It was filed under PHP and was tagged with PHP, php 7, php7.
Wordpress functions cross-reference from RedAlt
Wordpress roadmap
43 responses
Pingback: PHP 7.0 Final will ship November 12th 2015 | _ck_ says... WP EMAIL LISTS
WP “pros”
Pingback: Der PHP 7 Migration Guide - entwickler.de
WP hackers archive
WP testers archive
http://sourceforge.net/projects/mysqlwithmysqli/
In these wrappers all mysql and ereg functions are rewritten using mysqli and pcre
https://sourceforge.net/projects/mysqlwithmysqli/
WP THEMES
https://sourceforge.net/projects/ereg-using-pcre/
Alex King’s WP Theme collection
March 15, 2016 at 1:50 pm Template Monster Wordpress themes ($$$)
Gianluca
WP theme viewer (official)
Reply
Search
Register
April 29, 2016 at 10:19 pm
Log in
Entries RSS
Reply
Comments RSS
Claver Moraes WordPress.com
Reply
Anonymous
These instructions are mostly meant for linux environments but if you knew
how to compile on Windows, in theory it should also work. Alternately you
could use the prebuilt php libraries for Windows from Jan-E on
apachelounge.com
_ck_
https://www.apachelounge.com/viewtopic.php?t=6359
Reply
Anonymous
Nishchal Gautam
June 10, 2016 at 12:36 am
Reply
Reply
Anonymous
make install perfectly worked. it gives output path like: /usr/lib/php/20151012. but i
don’t know to what path i should change in extension path in php.ini file.
sandhya
August 27, 2016 at 4:16 am
Reply
Reply
sandhya
Reply
Ralph Metel
Reply
vivek
Thanks a lot!
Reply
Hacking Tutorials
it’s work!!!
thank you so much. i’ve tried to resolve this problem by a week, but i didn’t.
Reply
Alinamib Reply
how to convert mysql code into mysqli quickly ? i have a site based on mysql
http://imeibook.com and not working now because i coded into mysql please
urgent help required
Reply
Reply
Zachary Mcclave
That’s amazing
Ahmad Reply
Hey there, this worked for me and it totally saved my life so much!! !!!! But, strange
thing when running PHP from the command line I still get the Call to undefined
function mysql_connect()
Reply
hey I figured it out!! there are 2 php.ini one under /etc/php/7.0/apache2 and
there is another for cli under /etc/php/7.0/cli. I just needed to add the extension line
in the cli php.ini as well and it made the extension work on php cli as well
Reply
nano /etc/php.d/50-mysql.ini
with content
extension=mysql.so
Reply
Reply
Anonymous
Hey there,
I know it’s pretty sick to still use deprecated mysql_ext on PHP 7++ … but as i’m
stuck with a mega-old-mega-big Monolith PHP App I’m forced to do so (at least at
the moment until it get’s completely rewritten …)
Andreas S.
The App is working since years without Probs with PHP 7.0 – but now I try to
upgrade it to PHP 7.1 (or even 7.2 later) … but I got Problems compiling the old
Code:
if ((mysql_result=mysql_list_fields(mysql->conn, table, NULL))==NULL) {
php_error_docref(NULL, E_WARNING, “Unable to save MySQL query result”);
RETURN_FALSE;
}
RETURN_FALSE;
}
When I comment those Lines – it compiles fine and it works … but of course those
2 Functions making Problems …
Anyone here who could give me a Hint on how to fix those 2 Code Fragments to
get it to work with PHP 7.1?
thx
Andreas
Reply
I’m not using 7.1 yet but those two “errors” appear to only be warnings from
Reply
https://github.com/php/php-
Andreas S.
src/commit/398caf9336a5f6a71439969c7fd610bfaf522b93#diff-
48eed863ec9451a1280e0e2d1d8e45b0
As it’s getting harder to compile with every PHP Version I’ve gone
another way and used a mysql –> mysqli wrapper … took me some
Hours and everything was working fine with mysqli … even this is a
Project with some Million LOCs …
I will be sure to follow your other websites. This article is a bit too
advanced for me so is there anything you’d recommend for those just
starting out? Thank you so much for clearifing that third point, I’ve
been really confused about that for a long time. I’m always
browsingon the internet for insights that will help me.
Learn Belize
Reply
itsystemid
ilIO)”.,..,’)(
Reply
Jauh
Nice guide. I understand why they removed the mysql_query (etc) functions, but
for some legacy sites it is useful to be able to continue to use them.
webdevetc Reply
Reply
webdevetc
Thanks Antonio you are right, I had to add the with php config option because my
Ubuntu came with php 7.2 but I switched to php 7.1 manually to run certain picky
Pierre-Verthume
Larivière frameworks. didnt work until I add the sudo ./configure –with-php-
config=/usr/bin/php-config
note I think the forum transforms two dashes into 1 long weird dash so if you copy
this and it does not work that might be why.
Also in my case it was a little more complex. I had switched php version and
/etc/alternatives my php pointed to 7.1 but both phpize and php-config still pointed
to 7.2 that made it not work. Had to update those 2 as well with:
sudo update-alternatives –set php-config /usr/bin/phpize7.1
Then was able to ./configure with the Antonio option and finally it worked for me!!
Dont forget to add the extension both for apache and cli php.inis!! so it will work in
php running from the command lines (maybe in cronjobs etc..)
Reply
This does not work on CentOS 7. First problem is dat you need to install php-
devel. Secondly, the resulting so file will not load: cannot open shared object file:
No such file or directory), /usr/lib64/php/modules/mysql.so
(/usr/lib64/php/modules/mysql.so: undefined symbol: mysqlnd_get_client_info)) in
Unknown on line 0
Bart Coninckx
Reply
Reply
Bart Coninckx
Leave a Reply
Blog at WordPress.com.