Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

phpFastCache::$sys['method'] = "pdo"; #24

Closed
ksdev-pl opened this issue Jun 2, 2013 · 14 comments
Closed

phpFastCache::$sys['method'] = "pdo"; #24

ksdev-pl opened this issue Jun 2, 2013 · 14 comments
Assignees

Comments

@ksdev-pl
Copy link

ksdev-pl commented Jun 2, 2013

I have a "Call to a member function prepare() on a non-object in /php_fast_cache.php on line 1536" Fatal error when trying to: $recentArticles = phpFastCache::get("recentArticles");

This problem disappears when I add a 'phpFastCache::$sys['method'] = "pdo";' line to the code. Why is it so?

@ghost ghost assigned khoaofgod Jun 2, 2013
@khoaofgod
Copy link
Member

Hi, Can you help me on these data:

  1. Open your php_fast_cache.php , let me know the latest date updated on the script. It should be 5/31/2013.
  2. Copy the Error and The Code and paste here.
  3. Also, please re-download the php_fast_cache.zip , unzip it, and then upload it to the same server, and run "testing.php". Copy and paste the result here too.

I will take a look and finish it for u fast.

I am very interesting on your errors, so please help me gather these info, to help me know extractly about this error.

@ksdev-pl
Copy link
Author

ksdev-pl commented Jun 2, 2013

  1. It's 5/31/2013

Fatal error: Call to a member function prepare() on a non-object in /php_fast_cache.php on line 1536

It shows on this line in my code: $recentArticles = phpFastCache::get("recentArticles");

As I have written, it works ok when I manually add: phpFastCache::$sys['method'] = "pdo" line to the code.

As a side note, the testing.php also shows an error when I remove: phpFastCache::debug(phpFastCache::systemInfo()); line from it:

-------------------------------------------------
Caching = auto
SET 1 -->
Fatal error: Call to a member function prepare() on a non-object in /php_fast_cache.php on line 1626
Array
(
    [os] => Array
        (
            [os] => Linux
            [php] => ucgi5
            [system] => home.pl Linux x86_64
            [unique] => (something)
        )

    [errors] => Array
        (
        )

    [storage] => disk
    [method] => pdo
    [drivers] => Array
        (
            [apc] => 
            [xcache] => 
            [memcache] => 
            [memcached] => 
            [wincache] => 
            [pdo] => 1
            [mpdo] => 1
            [files] => 1
        )

)

Data will be testing - Included NULL and Emptry String

Array
(
    [0] => 1
    [1] => abc hello world
    [2] => 
    [3] => 
    [4] => 0
    [5] => Array
        (
            [0] => 1
            [1] => 2
            [2] => 3
            [3] => 4
            [4] => string
            [5] => 
            [6] => 
            [7] => GOT IT
            [KEY] => VALUE
            [N] => 
            [E] => 
            [X] => -1
        )

)

-------------------------------------------------
Caching = auto
SET 1 --> GET 1 = 1 Increase to 4 Decrease to 1 || Finished Testing || Deleted
SET 2 --> GET 2 = abc hello world || Finished Testing || Deleted
SET 3 --> GET 3 = || Finished Testing || Deleted
SET 4 --> GET 4 = || Finished Testing || Deleted
SET 5 --> GET 5 = 0 Increase to 3 Decrease to 0 || Finished Testing || Deleted
SET 6 --> GET 6 = Array ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 [4] => string [5] => [6] => [7] => GOT IT [KEY] => VALUE [N] => [E] => [X] => -1 ) || Finished Testing || Deleted
-------------------------------------------------
Caching = files
SET 1 --> GET 1 = 1 Increase to 4 Decrease to 1 || Finished Testing || Deleted
SET 2 --> GET 2 = abc hello world || Finished Testing || Deleted
SET 3 --> GET 3 = || Finished Testing || Deleted
SET 4 --> GET 4 = || Finished Testing || Deleted
SET 5 --> GET 5 = 0 Increase to 3 Decrease to 0 || Finished Testing || Deleted
SET 6 --> GET 6 = Array ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 [4] => string [5] => [6] => [7] => GOT IT [KEY] => VALUE [N] => [E] => [X] => -1 ) || Finished Testing || Deleted
-------------------------------------------------
Caching = pdo
SET 1 --> GET 1 = 1 Increase to 4 Decrease to 1 || Finished Testing || Deleted
SET 2 --> GET 2 = abc hello world || Finished Testing || Deleted
SET 3 --> GET 3 = || Finished Testing || Deleted
SET 4 --> GET 4 = || Finished Testing || Deleted
SET 5 --> GET 5 = 0 Increase to 3 Decrease to 0 || Finished Testing || Deleted
SET 6 --> GET 6 = Array ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 [4] => string [5] => [6] => [7] => GOT IT [KEY] => VALUE [N] => [E] => [X] => -1 ) || Finished Testing || Deleted
-------------------------------------------------
Caching = mpdo
SET 1 --> GET 1 = 1 Increase to 4 Decrease to 1 || Finished Testing || Deleted
SET 2 --> GET 2 = abc hello world || Finished Testing || Deleted
SET 3 --> GET 3 = || Finished Testing || Deleted
SET 4 --> GET 4 = || Finished Testing || Deleted
SET 5 --> GET 5 = 0 Increase to 3 Decrease to 0 || Finished Testing || Deleted
SET 6 --> GET 6 = Array ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 [4] => string [5] => [6] => [7] => GOT IT [KEY] => VALUE [N] => [E] => [X] => -1 ) || Finished Testing || Deleted
-------------------------------------------------
Caching = xcache
<-- NOT SUPPORTED ON THIS SERVER WITH DEFAULT CONFIG 127.0.0.1
-------------------------------------------------
Caching = apc
<-- NOT SUPPORTED ON THIS SERVER WITH DEFAULT CONFIG 127.0.0.1
-------------------------------------------------
Caching = memcache
<-- NOT SUPPORTED ON THIS SERVER WITH DEFAULT CONFIG 127.0.0.1
-------------------------------------------------
Caching = memcached
<-- NOT SUPPORTED ON THIS SERVER WITH DEFAULT CONFIG 127.0.0.1
-------------------------------------------------
Caching = wincache
<-- NOT SUPPORTED ON THIS SERVER WITH DEFAULT CONFIG 127.0.0.1

PHP Version 5.3.21

System  home.pl Linux x86_64
Server API  UltraCGI/1.0 for IdeaWebServer
Loaded Configuration File   /usr/local/php/php.ini
PHP API     20090626
PHP Extension   20090626
Zend Extension  220090626
Zend Extension Build    API220090626,NTS
PHP Extension Build     API20090626,NTS
Zend Memory Manager     enabled
Zend Multibyte Support  disabled
IPv6 Support    enabled
Registered PHP Streams  https, ftps, compress.zlib, compress.bzip2, php, file, glob, data, http, ftp, phar, zip
Registered Stream Socket Transports     tcp, udp, unix, udg, ssl, sslv3, sslv2, tls
Registered Stream Filters   zlib.*, bzip2.*, convert.iconv.*, mcrypt.*, mdecrypt.*, string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed, dechunk 
...

It it would take too much time to find a possible cause, please don’t bother your head about it - maybe it's just one strange case with my non-standard shared server?

@khoaofgod
Copy link
Member

thank you,
I am interesting on every everything that posted in issues, because I have to find out all of issues for next version of Php Fast Cache.

Can you help 1 more? Please come back to your testing.php , then Press CTRL + F , search "pdo_sqlite"
To see if your web server have PDO with sqlite or not.

The problem is maybe your server don't have "pdo_sqlite" , and my php_fast_cache force your server to use PDO, so the prepare statement not working. If your server don't have "pdo_sqlite", then I will make a fast update for my script / ignore pdo.

Please check it, and let me know.

If you trust me, can you email me your link to testing.php ( the original , not edit anything ), my email is "khoaofgod@yahoo.com", I will look at your server specs of phpinfo(); and find out what problems to improve php_fast_cache.php

Khoa,

@ksdev-pl
Copy link
Author

ksdev-pl commented Jun 3, 2013

Here is pdo_sqlite:

pdo_sqlite
PDO Driver for SQLite 3.x   enabled
SQLite Library  3.7.7.1 

If you need more information from phpinfo() (I cannot send you mine, but here is phpinfo example from my hosting: http://home.pl/files/phpinfo.php), please write.

Thank you for your answers!

@khoaofgod
Copy link
Member

Thanks man,
I will take care it when I back from my company today.

@khoaofgod
Copy link
Member

Ola, @ks-git

I found the problem, it is a big bug from the patched at May 31 ( last 5 days ago ).

On May 31, We did fix the always re-config bug to improve the speed of server faster, but when I applied that patched, I totally don't know that I have to do to self::$sys = $info;

Thanks for your issue report again,
Today Patched: 6/4/2013 at 11 AM have been fixed your issues and improved PHP Fast Cache faster than before.

Please re-download php_fast_cache.php again, in header it should show 6/4/2013 11 AM.

Your issues help me fix the class right away, if you don't report this issue, I wonder how many people will get same errors as you.

Have a nice day man, I have to run to my company, I am late already. Hahaha.

@ksdev-pl
Copy link
Author

ksdev-pl commented Jun 4, 2013

I confirm that new version is working without error. Thank you for your work!

@ksdev-pl ksdev-pl closed this as completed Jun 4, 2013
@mbenabda
Copy link

Hi khoaofgod, I get the same error
I'm running PHP 5.4.7, and pdo_sqlite is active on my server: SQLite Library 3.7.7.1

  1. Open your php_fast_cache.php , let me know the latest date updated on the script.

    -> can't find a date, but it's revision 616. I just cloned the repository.

  2. Copy the Error and The Code and paste here.
    ->
    Error is:

    Notice: Undefined index: method in /phpfastcache/php_fast_cache.php on line 291

    Notice: Undefined index: method in /phpfastcache/php_fast_cache.php on line 312

    Notice: Undefined index: method in /phpfastcache/php_fast_cache.php on line 322

    Notice: Undefined index: method in /phpfastcache/php_fast_cache.php on line 1501

    Fatal error: Call to a member function prepare() on a non-object in /phpfastcache/php_fast_cache.php on line 1575

Code to reproduce:

$nada = phpFastCache::get("nada");
phpFastCache::$storage = "auto";
phpFastCache::set("nada", array(), 864000); //10 days
  1. run testing.php. Copy and paste the result here.
    Try get Server information ... Take 10 - 15 seconds to detect ...

    Array ()

    Data will be testing - Included NULL and Emptry String

    Array (
        [0] => 1
        [1] => abc hello world
        [2] => 
        [3] => 
        [4] => 0
        [5] => Array (

                [0] => 1
                [1] => 2
                [2] => 3
                [3] => 4
                [4] => string
                [5] => 
                [6] => 
                [7] => GOT IT
                [KEY] => VALUE
                [N] => 
                [E] => 
                [X] => -1
            )

    )

    Caching = auto 
    SET 1 --> 
    Notice: Undefined index: method in /phpfastcache/php_fast_cache.php on line 291
    Notice: Undefined index: method in /phpfastcache/php_fast_cache.php on line 312
    Notice: Undefined index: method in /phpfastcache/php_fast_cache.php on line 322
    Notice: Undefined index: method in /phpfastcache/php_fast_cache.php on line 1501
    Fatal error: Call to a member function prepare() on a non-object in /phpfastcache/php_fast_cache.php on line 1665

Thanks in advance for any help

@khoaofgod khoaofgod reopened this Jun 22, 2013
@khoaofgod
Copy link
Member

hi @ks-git , can you do me a favor? Please download current version , and run it under your server to see if the current version still have problem or not.

@mbenabda , thanks for report to me. I have to wait @ks-git confirming his error still on current version 616 or not.
If it still here, I will check a look right away,

But if @ks-git 's problem not here anymore, then your problem is different. Maybe PHP version 5.4.7 have something that I have to take a look.

I will take care this problem for you soon, @mbenabda

@ksdev-pl
Copy link
Author

Hello

Yes, I get 'Fatal error: Call to a member function prepare() on a non-object in php_fast_cache.php on line 1575' in Revision 616

@khoaofgod
Copy link
Member

Thank you, have a small change on PHP 5.4, I have fixed it already.
Revision 617 have been updated.

@khoaofgod
Copy link
Member

Thanks @ks-git for getting back to me and confirm the error.
@mbenabda <-- I have fixed it already.

Just download the reivision 617 today.

After you confirm no more error, just close the topic for me.
I go to sleep.

@ksdev-pl
Copy link
Author

Rev 617 works OK.

@mbenabda
Copy link

thanks for the fix, it works for me as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants