[php] hx_error mysql_connect()

105 views
Skip to first unread message

theRemix

unread,
Aug 17, 2013, 5:52:04 PM8/17/13
to haxe...@googlegroups.com
I am deploying my haxe -> php website to a server with php-5.5.1 

I did a quick test and mysql_connect() is in fact working properly on this server, however, the php.db.Mysql class keeps throwing this error.

mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead (errno: 8192) in /var/www/localhost/lib/php/db/Mysql.class.php at line #7mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead

the same code does not throw this error on earlier versions of php-5.3

can someone lead me towards how i can squelch this error?

Norbert Melzer

unread,
Aug 17, 2013, 6:42:42 PM8/17/13
to haxe...@googlegroups.com
This is not an error, it is a warning.

Leave this on in development and change your error_reporting to E_NONE in production: <http://www.php.net/manual/en/errorfunc.configuration.php#ini.error-reporting>.

But you are right, probably there should be made a bug report in the haxe issue tracker (<https://github.com/HaxeFoundation/haxe/issues?state=open>) about that warning, so that the core team can make preparations for the future when the day comes and the PHP team releases PHP 6 *cough*.

Bye
Norbert

Franco Ponticelli

unread,
Aug 17, 2013, 10:14:54 PM8/17/13
to haxe...@googlegroups.com
The code in the std lib has just been changed to support DB connections only through PDO and it should fix you problem. Actually if you can test the latest code it would be awesome.

Franco


--
To post to this group haxe...@googlegroups.com
http://groups.google.com/group/haxelang?hl=en
---
You received this message because you are subscribed to the Google Groups "Haxe" group.
For more options, visit https://groups.google.com/groups/opt_out.

theRemix

unread,
Aug 18, 2013, 1:08:58 AM8/18/13
to haxe...@googlegroups.com
I set my php.ini to error_reporting = E_NONE
and that error still shows up.

theRemix

unread,
Aug 18, 2013, 1:09:56 AM8/18/13
to haxe...@googlegroups.com
Are you talking about haxe 2.10 or haxe 3?

this project is on haxe 2.10

Franco Ponticelli

unread,
Aug 18, 2013, 2:16:16 AM8/18/13
to haxe...@googlegroups.com
 Haxe 3, I guess you can patch 2.10 in the same way.

theRemix

unread,
Aug 18, 2013, 4:19:46 PM8/18/13
to haxe...@googlegroups.com
Can you direct me in a direction of how to patch my 2.10 installation with the fixes to mysql using PDO?

this is what i did, (after backing up)
copied the haxe3 /usr/lib/haxe/std/php/db directory to my 2.10 std
copied the haxe3 /usr/lib/haxe/std/sys/db directory to my 2.10 std
did a massive find and replace on my app 's/php.db/sys.db/'

when i compile i get an error due to the macros in 
/usr/lib/haxe/std/sys/db/Manager.hx:80: characters 8-13 : Unexpected macro

which is public macro function get(...)

any suggestions on how i should patch 2.10 ?

Franco Ponticelli

unread,
Aug 18, 2013, 4:25:27 PM8/18/13
to haxe...@googlegroups.com
I would restore all the files from 2.10 then in php.db.Mysql/Sqlite replace the content (excluded the package) with the contents from v3.

theRemix

unread,
Aug 22, 2013, 2:05:01 PM8/22/13
to haxe...@googlegroups.com
This is what i did, 

I copied all of the content from /usr/lib/haxe3/std/php/_std/sys/db/Mysql.hx (except for the package name)
into /usr/lib/haxe2/std/php/db/Mysql.hx

and same with Sqlite.hx

then i got some compile errors due to the getter methods 
public var length(get,null) : Int;
public var nfields(get,null) : Int;

so i fixed them to work on haxe2
public var length(getLength,null) : Int;
public var nfields(getNFields,null) : Int;

then once it compiled, the resulting php files were the same except for this change.
--- a/deploy/lib/php/db/_Mysql/MysqlResultSet.class.php
+++ b/deploy/lib/php/db/_Mysql/MysqlResultSet.class.php
@@ -85,6 +85,9 @@ class php_db__Mysql_MysqlResultSet implements sys_db_ResultSet{
                case "datetime":case "date":{
                        return Date::fromString($v);
                }break;
+               case "blob":{
+                       return haxe_io_Bytes::ofData($v);
+               }break;
                default:{
                        return $v;
                }break;

Should i be copying over the other php.db.* classes from haxe3 to haxe2.10 as well?
Connection.hx           Object.hx         ResultSet.hx    
Manager.hx               PDO.hx           Transaction.hx

Franco Ponticelli

unread,
Aug 22, 2013, 2:43:32 PM8/22/13
to haxe...@googlegroups.com
You can try but I don't use php/db myself so I cannot really say.

theRemix

unread,
Aug 28, 2013, 7:14:20 PM8/28/13
to haxe...@googlegroups.com
I installed php-5.3 and all works well again.

when i migrate to haxe3, i will test php-5.3 and php-5.5 with pdo.
Reply all
Reply to author
Forward
0 new messages