VectorLinux

Please login or register.

Login with username, password and session length
Advanced search  

News:

Visit our home page for VL info. For support and documentation, visit the Vector Linux Knowledge Center or search the Knowledge Center and this Forum using the search box above.

Author Topic: Lighttpd with PHP, SQLite and GD  (Read 158 times)

SmartDuck

  • Member
  • *
  • Posts: 68
    • The Smart Duck Company
Lighttpd with PHP, SQLite and GD
« on: July 30, 2015, 03:23:48 am »

I' m setting up a light web server to test my projects. So far I managed to get Lighttpd with PHP fast-cgi working. That was the easy part :)
Now I'm trying to get SQLite and GD working. I don't know if I have to install php5-sqlite and php5-gd.
Php info states --with-pdo-sqlite=shared and --with-gd=shared . Any direction where to look for?
I'm running VL 7.1 STD.
Logged
Dell Lattitude E4300 - Vector Linux 7.1 STD - daily workstation
Dell Lattitude D505 - Vector Linux 7.1 Light - test and MineCraft server
Raspberry Pi B+ - OpenElec 5.0.8 - Multimedia player
Raspberry Pi A+ - Raspbian Weezy - Green house server
My wife: Dell Lattitude E5400 - Vector Linux 7.1 STD

SmartDuck

  • Member
  • *
  • Posts: 68
    • The Smart Duck Company
Re: Lighttpd with PHP, SQLite and GD
« Reply #1 on: July 30, 2015, 03:34:48 am »

Solved :)

I had to rename one of the php.ini files in /etc/httpd/ . There are two of them, one for development and one for production.
Logged
Dell Lattitude E4300 - Vector Linux 7.1 STD - daily workstation
Dell Lattitude D505 - Vector Linux 7.1 Light - test and MineCraft server
Raspberry Pi B+ - OpenElec 5.0.8 - Multimedia player
Raspberry Pi A+ - Raspbian Weezy - Green house server
My wife: Dell Lattitude E5400 - Vector Linux 7.1 STD

SmartDuck

  • Member
  • *
  • Posts: 68
    • The Smart Duck Company
Re: Lighttpd with PHP, SQLite and GD
« Reply #2 on: July 30, 2015, 04:20:37 am »

Small howto Lighttpd with PHP, SQLite for other fellow Vectorians that run into trouble:

Install Lighttpd and PHP
First install Lighttpd and PHP 5.6.9 via Gslapt, it's the simple part, just go to menu -> system -> Gslapt Package Manager and search for lighttpd and php.

Running Lighttpd
Lighttpd is not running after install. Open a terminal and log in as root. With /etc/rc.d/rc.lighttpd start -> the web server is started, with /etc/rc.d/rc.lighttpd stop -> it stops and /etc/rc.d/rc.lighttpd restart -> restarts the web server.

Enable PHP
Edit the lighttpd.config file. For example with Geany:

# geany /etc/lighttpd/lighttpd.conf

Remove the # at the beginning of line 24 to enable fastcgi.
Replace the fastcgi section beginning at line 209 with:

fastcgi.server = ( ".php" => ((
        "bin-path" => "/usr/bin/php-cgi",
        "socket" => "/tmp/php.socket"
)))

Save the configuration.

Enable the php ini file:
# cp /etc/httpd/php.ini-development /etc/httpd/php.ini or # cp /etc/httpd/php.ini-production /etc/httpd/php.ini for a live web server.

The PHP package is configured for Apache. So you will have to correct the group for PHP to save sessions.
# chown root:lighttpd /var/lib/php

Restart Lighttpd:
# /etc/rc.d/rc.lighttpd restart

And place your PHP files in /var/www/htdocs-lighttpd and correct the user and group on these files:
# chown lighttpd:lighttpd <filename>

Open a browser and goto http://localhost to browse your PHP web site.
You can check if all PHP options are functioning, create a file index.php in /var/www/htdocs-lighttpd with this code:

<?php
   echo phpinfo();
?>

and goto http://localhost.

   
« Last Edit: July 30, 2015, 03:09:46 pm by SmartDuck »
Logged
Dell Lattitude E4300 - Vector Linux 7.1 STD - daily workstation
Dell Lattitude D505 - Vector Linux 7.1 Light - test and MineCraft server
Raspberry Pi B+ - OpenElec 5.0.8 - Multimedia player
Raspberry Pi A+ - Raspbian Weezy - Green house server
My wife: Dell Lattitude E5400 - Vector Linux 7.1 STD

M0E-lnx

  • Administrator
  • Vectorian
  • *****
  • Posts: 3279
Re: Lighttpd with PHP, SQLite and GD
« Reply #3 on: July 30, 2015, 04:34:37 am »

Wow... That's pretty cool... Thanks for the quick run down

SmartDuck

  • Member
  • *
  • Posts: 68
    • The Smart Duck Company
Re: Lighttpd with PHP, SQLite and GD
« Reply #4 on: July 30, 2015, 03:18:56 pm »

Thanx, the PHP package in the repository is very complete. SQLite PDO for example works, no extra configuration needed.
Logged
Dell Lattitude E4300 - Vector Linux 7.1 STD - daily workstation
Dell Lattitude D505 - Vector Linux 7.1 Light - test and MineCraft server
Raspberry Pi B+ - OpenElec 5.0.8 - Multimedia player
Raspberry Pi A+ - Raspbian Weezy - Green house server
My wife: Dell Lattitude E5400 - Vector Linux 7.1 STD

SmartDuck

  • Member
  • *
  • Posts: 68
    • The Smart Duck Company
Re: Lighttpd with PHP, SQLite and GD
« Reply #5 on: September 01, 2015, 10:16:35 am »

Don't forget to set the time zone in the php.ini file if you use date time functions.
Location: /etc/httpd/
Example:
date.timezone = "Europe/Amsterdam"
Logged
Dell Lattitude E4300 - Vector Linux 7.1 STD - daily workstation
Dell Lattitude D505 - Vector Linux 7.1 Light - test and MineCraft server
Raspberry Pi B+ - OpenElec 5.0.8 - Multimedia player
Raspberry Pi A+ - Raspbian Weezy - Green house server
My wife: Dell Lattitude E5400 - Vector Linux 7.1 STD