RSS
 

Archive for the ‘PHP’ Category

Trying to clone an uncloneable object of class stdClass

20 Jun

Ran into the following error recently:

PHP Fatal error: Trying to clone an uncloneable object of class stdClass in /wp-includes/cache.php

Adding the following to the PHP config fixed the error

; Adding for wp-e-commerce plugin
zend.ze1_compatibility_mode = Off

The ze1_compatiblity_mode is removed in PHP 5.3 so in that case I needed to wrap the clone calls with

function clone_it($data)
{
if(get_class($data) != ‘stdClass’)
return clone $data;
else
return unserialize(serialize($data));
}

 
 

PHP ODBC Across Networked Drives

20 Aug

While integrating some backend services needed by our RIA I ran across a small hiccup that was easily fixed but I thought I’d post in case someone else get’s stumped by this (apparently some already have ).

Problem:

PHP needed access to and ODBC connection that pointed to a dBase III database on a remote server. While local applications could use this ODBC connection flawlessly, connection via PHP failed.

Symptons:

Warning: odbc_connect() [function.odbc-connect]: SQL error: [Microsoft][ODBC dBase Driver] ‘(unknown)’ is not a valid path.

Solution:

You need to enable rights for the Apache Service to have access to the remote directory.

For my particluar situation the server running apache and php was not part of the domain, so I simply right clicked on the apache service, navigated to the Log On tab and selected “This Account” (and filled in the administrator credentials) as opposed to the default “Local System Account.”

 
1 Comment

Posted in PHP

 

PHPbb over 443 (https)

14 Feb

Quick heads up for anyone having trouble getting phpbb to working under a secure (https) installation. You may have to manually go in and change cookie_secure from 0 to 1 in the database table `_config`.

 
No Comments

Posted in PHP, PHPbb

 

PHP – Large File Uploads

05 Feb

Okay, here’s a quick check list of php.ini variables that may need tweeking for allowing large file uploads…

file_uploads (You’ll want this set to “On”)
upload_max_filesize (2MB default)
post_max_size (8MB default)
max_execution_time
max_input_time
memory_limit

My $_FILES array kept turning up empty, turned out to be the post_max_size still set at 8MB.

 
No Comments

Posted in PHP

 

dbtcp on SuSe 10.x

07 Nov

First off, to compile dbtcp as a PHP extension, you’ll need to have phpize installed. I didn’t, so I opened up YAST and click on PHP’s devel package. A YAST dependency warning is thrown, click remove php-devel, press OK, select ignore and OK.

Extract archive to /usr/src/dbtcp

>cd /usr/src/dbtcp

Opened MakeFile and added -fPIC to CCFLAGS (line 11)
Opended dbug/dbug.c and commented out IMPORT int fprintf(); (line 210)

>make
>cd /usr/src/dbtcp/php/dbtcp
>phpize
>./configure –with-dbtcp=/usr/src/dbtcp
>make
>make install

Create a file, “/etc/php5/conf.d/dbtcp.ini” with contents of
extension=dbtcp.so

>service apache2 restart

At this point dbtcp is installed and “good to go” on the SuSe box. Let’s try it out!

Run DBTCP.exe
I went ahead and clicked on the “Allowed IPs” icon (it’s the icon with the bust of a person) and typed in the IPAddress of the SuSe box.

Okay back to SuSe. We need a quick PHP script to test things out…


");

$dsn = "DSN=Projects";
$host = "10.10.10.10";

$handle = dbtcp_connect($dsn,$host);

if(dbtcp_sql("SELECT * FROM sometable"))
{
while($row = dbtcp_fetch_assoc())
var_dump($row);
}

var_dump($handle);
?>

That’s it, you just saved yourself from buying a $1,500 driver 🙂

 
2 Comments

Posted in dbtcp, PHP, Suse