Archive for the 'PHP' Category

Nanoweb – an HTTP server written in PHP

Today I tried to find a light weight server that support PHP, then I found this one, Nanoweb

Nanoweb is an HTTP server written in PHP, designed to be small, secure, and extensible.
It is distributed under the terms of the GNU General Public License.
Nanoweb’s main features are :
- HTTP/1.1 compliance
- Powerful and easy configuration
- Modular architecture
- FastCGI, CGI and Server side includes support
- Name and port based virtual hosts
- Access control lists
- htpasswd, MySQL, PostgreSQL and LDAP authentication support
- Themes for server generated content
- Apache compatible log format, MySQL logging
- Directory browsing
- inetd support and SSL via external helpers
- Denial of Service protection
- Proxy Server extension
- Filters and gzip support
- RBL support (mail-abuse.org)
- Extension Protocols (request methods) support
- … and a lot more

It is very easy to implement on window XP.

  • Download the PHP 5.2.8 zip package, unzip it in c:\php\
  • Unzip the nanoweb_2.2.9.tgz and run the install.bat, and c:\nanoweb will created
  • Run c:\nanoweb\nanostart.bat
  • Browser http://localhost and enjoy it.

Somebody has Installed Wordpress locally with NanoWeb Server under Ubuntu Gutsy 7.10
I think it will be interesting if I can Install Wordpress locally with NanoWeb Server under Windows as my own private diary, had better use sqlite, not mysql server, PDO (SQLite) For Wordpress.

Share and Enjoy:
  • Digg
  • del.icio.us
  • Netvouz
  • DZone
  • ThisNext
  • MisterWong
  • Wists
  • BlinkList
  • blogmarks
  • blogtercimlap
  • connotea
  • DotNetKicks
  • Fark
  • Fleck
  • Gwar
  • Haohao
  • IndianPad
  • Internetmedia
  • LinkaGoGo
  • MyShare
  • Netscape
  • NewsVine
  • Rec6
  • Reddit
  • Scoopeo
  • Slashdot
  • StumbleUpon
  • Technorati
  • Webride

Parsing XFDF in PHP

A handy snippet of PHP code that can be used to parse XFDF data.
This past week at work I have been working on using Adobe Acrobat to submit form data. The value of this is that the form data can be reimported into the PDF form then printed all purty-lookin’. Anyway, Acrobat allows you to submit your form data in several different formats. One, FDF, is usable in PHP provided you load this module thingy. Unfortunately, the server I want to run the PHP script on uses Irix and the module is unavailable for Irix. Poor.

I then turned to XFDF, which is essentially FDF data all XML-ified. PHP has an XML parser built in, so I don’t have to load any crazy modules to parse the data. Unfortunately, PHP’s parser is SAX-based rather than DOM-based, so it took me a rather long time to figure out how to get it working right. Anyway, here’s the PHP code that essentially takes XFDF data (declare $file as a string pointing to the location of your XFDF file) and parses it into an associative array ($values). The array is indexed by the XFDF field names. The code below is not entirely complete since I snipped it out of a larger file, but if you look at it, I think you’ll get the idea. It’s pretty simple once you figure out the way PHP does XML processing.

View Code

Contributed by: Tyler Butler

Share and Enjoy:
  • Digg
  • del.icio.us
  • Netvouz
  • DZone
  • ThisNext
  • MisterWong
  • Wists
  • BlinkList
  • blogmarks
  • blogtercimlap
  • connotea
  • DotNetKicks
  • Fark
  • Fleck
  • Gwar
  • Haohao
  • IndianPad
  • Internetmedia
  • LinkaGoGo
  • MyShare
  • Netscape
  • NewsVine
  • Rec6
  • Reddit
  • Scoopeo
  • Slashdot
  • StumbleUpon
  • Technorati
  • Webride

Using Permanent Redirect with HTTP 301 to correct my nonexistent links

Because of some reasons, I have deleted some sub folders of my website, then I always get the “404 Report”, for example,

404 Report – a file not found error was registered on your site.
404 URL: http://blog.rubypdf.com/downloads/
Referred by: http://forum.telecharger.01net.com/microhebdo/logiciels/bureautique/convertisseur_pdf_en_ppt-334264/messages-1.html
User Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11

so I tried to set Permanent Redirect with HTTP 301 in .htaccess in this way

# BEGIN WordPress

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

Redirect 301 /download/index.php /download/
Redirect 301 /download/dl.php(.*) /downloads/dl.php$1
Redirect 301 /phpcounter/(.*) /
Redirect 301 /sitemap/(.*) /
# END WordPress

but it does not work now, and I had no idea why(I tried the same method in other folder, works), now I had to solve it in another way “HTTP 301 Redirect in PHP”, for example,

// Permanent redirection
header("HTTP/1.1 301 Moved Permanently");
header("Location: http://blog.rubypdf.com/");
exit();
?>

and it works now.

Share and Enjoy:
  • Digg
  • del.icio.us
  • Netvouz
  • DZone
  • ThisNext
  • MisterWong
  • Wists
  • BlinkList
  • blogmarks
  • blogtercimlap
  • connotea
  • DotNetKicks
  • Fark
  • Fleck
  • Gwar
  • Haohao
  • IndianPad
  • Internetmedia
  • LinkaGoGo
  • MyShare
  • Netscape
  • NewsVine
  • Rec6
  • Reddit
  • Scoopeo
  • Slashdot
  • StumbleUpon
  • Technorati
  • Webride