Welcome! Log In Create A New Profile Forum Rules

Advanced

Script 14.1 - mysql_connect.php

Posted by markboyd 
Script 14.1 - mysql_connect.php
four years ago
I am trying to get the new improved version of this connect script working on my server.

I have it working on my notebook using Marc Liyanage's installation of PHP Version 5.0.4 www.entropy.ch Release 1 and MySQL 4.1.16-standard

The version That I can't get running. PHP Version 5.1.2 with MySQL 4.1.18-standard. I have installed the old version of the ecommerce site from PHP&MySQL edition#1 and it seems to work fine.

The line causing the error is.
// Improved MySQL Version:
$dbc = mysqli_connect (DB_HOST, DB_USER, DB_PASSWORD, DB_NAME) OR die ('Could not connect to MySQL: ' . mysqli_connect_error() );

And the error is.
PHP Fatal error: Trying to clone an uncloneable object of class mysqli in /mysql_connect.php on line 15

The mysqli settings seem to be the same. except for the following.


On my notebook.

mysqli
MysqlI Support enabled
Client API version 4.1.3-beta

On the server.
mysqli
MysqlI Support enabled
Client API version 4.1.16


Anybody aware of what might be causing this error (Trying to clone an uncloneable object), and how to remidy it?

Any help greatly appreciated.





Re: Script 14.1 - mysql_connect.php
four years ago
A Google search indicates that you need to disable zend.ze1_compatibility_mode in the PHP.INI file on the server generating the error.

See this thread on Zend's forum:
http://www.zend.com/phorum/read.php?num=6&id=1304&loc=0&thread=1304.

____________

Paul Swanson
Portland, OR
USA
____________


PHP Version 4.4.0
MySQL Version 4.1.22
Apache Version 1.3.37
Server OS: Linux Version 2.4.20-8
Workstation OS: Windows XP Pro SP2
Re: Script 14.1 - mysql_connect.php
four years ago
Thanks for finding that, and I think that you would fix the problem.
The problem is I don't have access to the php.ini file.

zend.ze1_compatibility_mode
I did a search regarding this and found the following.

[php.mirrors.ilisys.com.au]
--->>>
zend.ze1_compatibility_mode boolean
Enable compatibility mode with Zend Engine 1 (PHP 4). It affects the cloning, casting (objects with no properties cast to FALSE or 0), and comparing of objects. In this mode, objects are passed by value instead of reference by default.

See also the section titled Migrating from PHP 4 to PHP 5.
--->>>


The web host that I am using this may have set it as such to allow some PHP 4 combatibility??? Should I just ask them to change the setting. What might this affect regarding other sites on the server?



Re: Script 14.1 - mysql_connect.php
four years ago
You should be able to override that setting using ini_set(). Check the manual page at http://www.php.net/manual/en/function.ini-set.php for the syntax.

____________

Paul Swanson
Portland, OR
USA
____________


PHP Version 4.4.0
MySQL Version 4.1.22
Apache Version 1.3.37
Server OS: Linux Version 2.4.20-8
Workstation OS: Windows XP Pro SP2
Re: Script 14.1 - mysql_connect.php
four years ago
Thanks for that last tip as well Paul. I was able to get the php.ini reconfigured with no affect to any of my other scripts, The ini_set() function looks like it could be very helpfull in some situations as well.

Mark
Sorry, only registered users may post in this forum.

Click here to login