>
> Hello,
>
> I'm not new to Zend DB, but now I've a strange segmentation fault.
> My configuration:
> - server: Ubuntu 8.04.1, Kernel Version 2.6.24-22-generic (SMP)
> - PHP Version 5.2.4-2ubuntu5.3
> - ZendFramework-1.7.0
> - data base: PostgeSQL 8.3
>
> Any command that call the db return a Seg Fault in the Apache and in the
> console (PHP5-cli), anyway the code seems to work correctly, but in the
> error.log of Apache or in the console I've the Seg Fault
>
> I've done a small code for test:
>
> <code>
>
> $path_zend = $path_libs . "/ZendFramework-1.7.0";
>
> ...
>
> require_once "Zend/Config/Xml.php";
> require_once "Zend/Db/Table/Abstract.php";
> require_once "Zend/Db.php";
>
> $db_config = new Zend_Config_Xml("db_test_config.xml", "database");
> echo $db_config->params->dbname; // TEST: prints "dbname"
>
> $db = Zend_Db::factory($db_config);
> Zend_Db_Table_Abstract::setDefaultAdapter($db);
> print_r($db->listTables()); //TEST: print db tables
>
> </code>
>
> The "echo" test do not return a Seg Fault, so the problem isn't in all the
> Zend library
> The "print_r" return the seg fault after print the tables in the db.
>
> I try some query with the psql commands directly in the PostgreSQL and all
> work well.
>
>
> Thanks a lot!
That's hardly a test-case.
For starters, I see at least two components in your code. How do you
know the problem is not trigger in the Zend_Config code? ;-) You
didn't include the config.xml, nor did you tell us how many tables are
in your database, and so, and so on.
Also, before running it through Apache, can you run it on the shell
(through php cli) and see if that works? If it segfaults, I suggest
running the script through strace to figure out where exactly the
crash occurs. You could also use Valgrind.
I don't have PostgreSQL here, but I can help you try to debug this, so
what I suggest is the following:
a) A pure PHP script which does the SHOW TABLES query (through PDO).
b) A pure Zend_Db (no Zend_Config) script which does the list tables.
Of course, all outside of MVC. The less dependencies, the better.
If either crashes, run it through strace/dtrace/truss or Valgrind
(e.g. strace php test.php). If the pure PHP script crashes already,
then the problem is most likely not in the framework code.
Let me know what you find,
Till
没有评论:
发表评论