0

I just started using phpliteadmin to manage a SQLite database [1].

I set up local access using the build-in webserver in php5.4, exactly as shown the documentation [2]:

php -S localhost:8000
http://localhost:8000/phpliteadmin.php 

I want to:

(1) Share phpliteadmin acess with several others on my network.

(2) Set up phpliteadmin with an Apache webserver (in case I needed to migrate away from the php server).

Interested in suggestions regarding ways to do both?


[1] On Linux machine running CentOS 6

[2] http://code.google.com/p/phpliteadmin/wiki/NoWebserver

lmart999
  • 6,671
  • 10
  • 29
  • 37

1 Answers1

0

I solved both, but wanted to open up what I did (perhaps it can be improved or is useful to others).

(1) Straightforward way to host using php5.4 webserver (specify IP address):

php -S <ip_address>:8000
http://<ip_address>:8000/phpliteadmin.php 

(2) Host using Apache httpd (on CentOS 6) [1]:

(a) Set hostname of the webserver: /etc/sysconfig/network

NETWORKING=yes
HOSTNAME=<NAME_OF_CHOICE>
NTPSERVERARGS=iburst

(b) Modify hosts file: /etc/hosts

<IP_ADDRESS> <NAME_OF_CHOICE>

(c) Modify Apache config file and include phpliteadmin.php as the default index : /etc/httpd/conf/httpd.conf

## Line 262 - Set the server admin mail ##
ServerAdmin <e-mail>    
## Line 276 - Set the website name ##
ServerName <IP_ADDRESS>:80
## Line 292 - Set the web pages folder ##
DocumentRoot "/var/www"
## line 402 - Sent the index or home page of the website ##
DirectoryIndex phpliteadmin.php

(d) Make sure the server has php enabled. CentOS PHP module for Apache httpd is called "libphp5" [2]. For php54w install, the file was in: /usr/lib64/httpd/modules/libphp5.so

(e) Modify Apache config file [3]: /etc/httpd/conf/httpd.conf

LoadModule php5_module modules/libphp5.so
AddType application/x-httpd-php .php

(f) Move phpliteadmin.php to document root of the webserver.

(g) Modify $directory in phpliteadmin.php to point to the directory of the database.

(h) Modify iptables to allow webserver through firewall: /etc/sysconfig/iptables

-A INPUT -p tcp -m state --state NEW --dport 80 -j ACCEPT
-A INPUT -p tcp -m state --state NEW --dport 80 -j ACCEPT

(i) Re-boot iptables:

service iptables restart

(j) Start the webserver:

service httpd start

(h) The server IP address in browser should recognize the phpliteadmin.php file and ask for database login.

If the .php file raw text displays, then php is not loading correctly and check step (e). If php loads, but reports database not found and / or directory not writable, check permissions on the database and DocumentRoot that phpliteadmin.php sits in (e.g., /var/www required sudo to modify and I had to open permissions).


[1] http://ostechnix.wordpress.com/2013/03/05/install-apache-webserver-in-centos-6-3-scientific-linux-6-3-rhel-6-3/

[2] http://www.rackspace.com/knowledge_center/article/centos-apache-and-php-install

[3] PHP code is not being executed, instead code shows on the page

Community
  • 1
  • 1
lmart999
  • 6,671
  • 10
  • 29
  • 37