Webserver

From ift
Jump to: navigation, search

CGI scripts

$ cd /opt/petalinux-v1.3-final-full/software/petalinux-dist
$ petalinux-config-apps

Scroll to PetaLogix Demo Applications and enter. Uncheck uWeb and exit. Scroll to BusyBox->Networking Utilities and make sure httpd is checked. Exit and make the Petalinux image. The server files is now located in '/home/httpd'. CGI scripts should go in cgi-bin directory and chmoded to +x.

Here is a simple script used to read and write to memory using 'devmem'.

Interface

[1]

Troubleshooting

First I tried to modify the default page source files (i.e. petalinux.page) but found out that the whole page is some binary, so the uWeb API is needed.

Then I set out to install php.

  • Attempt 1

Follow the guide by Georges Ménie (excluding boa). I downloaded php-4.3.10 and applied Georges' patch. Did not compile, so I did some desperate fiddling and came to short.

  • Attempt 2
    • Downloaded the latest php-5.3.6.
    • Extracted to '/opt/petalinux-v1.3-final-full/software/petalinux-dist/user' to a folder 'php'.
    • Edit /opt/petalinux-v1.3-final-full/software/petalinux-dist/user/Makefile:
dir_$(CONFIG_USER_PHP_PHP)                  += php
    • Edit /opt/petalinux-v1.3-final-full/software/petalinux-dist/config/Kconfig
config USER_PHP_PHP
       bool "php"
       help
         Testing php support

This adds the php application to the petalinux-config-apps ui where we can select it to be compiled to the petalinux image.

    • Enter php directory in user catalog
./configure --disable-all
    • Edit /opt/petalinux-v1.3-final-full/software/petalinux-dist/user/php/Makefile
CC = /opt/petalinux-v1.3-final-full/tools/linux-i386/microblaze-unknown-linux-gnu/microblaze-unknown-linux-gnu/bin/gcc

When compiling the petalinux image, I get no errors in the compile step of php, but get a romfs error during the install step. I believe it has something to do with the large filesize of the php binary or some problem with the Makefile.

References

  1. uClinux - Adding user applications
  2. BOA + PHP for uClinux
  3. CGI html form example 1
  4. CGI security, to be read
  5. Bourne shell reference
  1. Les