Call of certain PHP functions makes THTTP Server crash

I am setting up a webserver on a ARM9-based embedded Linux using THTTP. The server should be capable of handling PHP and SQLite3. First I set up a testfile, calling
[php]<?php
phpinfo();
?>[/php]
it went well, i had a good looking output file (which i unfortunately cant post since im not allowed to post links…)

then i tried a first call of a sqlite database, where the server crashed after i called the corresponding site.php. First intention: SQLite not correctly linked. But on my debugging way, i tried to print out the SQLite Version using another testfile:
[php]<?php
print_r(SQLite3::version());
?>
[/php]
which failed. I tried to define a little array and print_r that out
[php]<?php
$a=array(‘a’=>'alpha,‘b’=>‘beta’,‘c’=>array(‘x’,‘y’,‘z’));
print_r($a);
?>[/php]
result the same: It made the webserver shut down. But on the other hand i can call for example [php]<?php
echo ‘Hello’;
?>[/php] without any problems. Anyone an idea how to trace down the problem?

unfortunately unformatted, but better than nothing…

extract from phpinfo():

PHP Version 5.3.6
System Linux triton1 2.6.31 #119 PREEMPT Wed Apr 20 16:06:16 CEST 2011
      armv5tejl
Build Date Dec 5 2011 14:58:52
Configure './configure' '--host=arm-926ejs-linux-gnueabi' '--build=i686-linux-gnu'
  Command '--target=arm-926ejs-linux-gnueabi' '--with-thttpd=/home/digisens/starterkit
         /rootfs-buildV11_uboot/thttpd-2.21b' '--without-pear' '--with-pdo-sqlite=/usr
        /local' '--disable-all' '--enable-short-tags' '--enable-session' '--enable-sockets'
       '--enable-pdo' '--with-sqlite3=/usr/local' '--with-config-file-path=/etc'
          '--enable-libxml' '--with-libxml-dir=/usr/local' '--prefix=/usr/local'
Server API thttpd
Virtual Directory disabled
Support
Configuration /etc
  File (php.ini) 
  Path 
Loaded /etc/php.ini
Configuration 
  File 
Scan this dir for (none)
additional .ini 
files 
Additional .ini (none)
files parsed 
PHP API 20090626
PHP Extension 20090626
Zend Extension 220090626
Zend Extension API220090626,NTS
Build 
PHP Extension API20090626,NTS
Build 
Debug Build no
Thread Safety disabled
Zend Memory enabled
Manager 
Zend Multibyte disabled
Support 
IPv6 Support enabled
Registered PHP php, file, glob, data, http, ftp
Streams 
Registered tcp, udp, unix, udg
Stream Socket 
Transports 
Registered string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*,
Stream Filters consumed, dechunk

There are hundreds of possibilities! First, does the server post HTML pages without issues?
Since this is really a LINUX or SQLite3 issue, we might not be able to help. Is there a certain reason
why you are using that version of LINUX? Also, SQLite3? The reason I ask is that it seems most
people are using MySQL not SQLite, I am wondering if that is the issue…

Well, I would first test a few standard, NON-PHP pages and see if they display first.
If not, then, it is not a PHP problem. In which case it is most likely your LINUX.
And, if they do show, then, most likely it is the PHP and you should reinstall that.

Not sure if this helped, but, let us know if the standard HTML works first…

First of all - thanks for your answer. For your questions:

  • html pages are no problem, i threw the example pages from flot (code.google.com/p/flot/) on the server, and the only page posing problems is basic.html (issues displaying the embedded <?php ?> content).
  • in most of my my tests, sqlite3 wasn’t even called (the print_r test with the array), so imho it shouldn’t be a big deal? correct me if I’m wrong.
  • we got sqlite3 because its more lightweight than MySQL e.g. the library size is usually less than 350k and its designed to run in minimal environments. Since our embedded Linux is running on a 400MHz ARM with 32MB SDRAM and the webserver is just an additional feature, it should consume as less resources as possible.
  • and for the linux version - i got a pre-compiled kernel for my board from the producer & to be honest I’m trying to avoid crosscompiling a own kernel :slight_smile:

edit:

sorry, the .html examples are all working, someone else was tinkering on my piece of code… in the standard version there is no php part…

Okay, you have explained everything. Seems like your server is okay and running normally.
Seems like HTML is working correctly. And, did you test your SQLite yet? That would be the next step.
The reason I ask is that you are down to two possible error causing services. The SQLite or the PHP.
Either could be the cause. With only 32megs of RAM, I suspect you are running out of memory.
I would remove the SQL lite first and try getting the server to work with just HTML and PHP to start.
In this way, you would rule out PHP. If it works, then add SQLite back in.

I did some reading and found that 32megs of RAM seems to be the common issue. But, some people have got it to work. Not sure what else to try… Sorry I could not be further help…

Sponsor our Newsletter | Privacy Policy | Terms of Service