Installing Lighttpd With PHP5 And MySQL Support On Debian Etch - Page 2

Want to support HowtoForge? Become a subscriber!
 
Submitted by falko (Contact Author) (Forums) on Thu, 2007-08-09 17:09. ::

6 Testing PHP5 / Getting Details About Your PHP5 Installation

The document root of the default web site is /var/www. We will now create a small PHP file (info.php) in that directory and call it in a browser. The file will display lots of useful details about our PHP installation, such as the installed PHP version.

vi /var/www/info.php

<?php
phpinfo();
?>

Now we call that file in a browser (e.g. http://192.168.0.100/info.php):

As you see, PHP5 is working, and it's working through FastCGI, as shown in the Server API line. If you scroll further down, you will see all modules that are already enabled in PHP5. MySQL is not listed there which means we don't have MySQL support in PHP5 yet.

 

7 Getting MySQL Support In PHP5

To get MySQL support in PHP, we can install the php5-mysql package. It's a good idea to install some other PHP5 modules as well as you might need them for your applications. You can search for available PHP5 modules like this:

apt-cache search php5

Pick the ones you need and install them like this:

apt-get install php5-mysql php5-curl php5-gd php5-idn php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-mhash php5-ming php5-ps php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl php5-json

You might see a question like this one:

Continue installing libc-client without Maildir support? <-- Yes

Now restart Lighttpd:

/etc/init.d/lighttpd restart

(If you've installed the module php5-json and get warnings like this one:

PHP Warning: Module 'json' already loaded in Unknown on line 0

it means that the module got loaded twice. Open /etc/php5/cgi/php.ini, scroll down to the end and comment out the line extension=json.so:

vi /etc/php5/cgi/php.ini

[...]
;extension=json.so
[...]

Then restart Lighttpd again:

/etc/init.d/lighttpd restart

The warnings should now be gone.)

Now reload http://192.168.0.100/info.php in your browser and scroll down to the modules section again. You should now find lots of new modules there, including the MySQL module:

 

8 Links


Please do not use the comment function to ask for help! If you need help, please use our forum.
Comments will be published after administrator approval.
Submitted by Anonymous (not registered) on Tue, 2014-01-28 22:20.
what is the url for the phpmyadmin interface? http://192.168.2.212/phpmyadmin is not working :(
Submitted by moehb1 (registered user) on Mon, 2009-06-22 16:45.

Great Tutorial. A quick guid to my own Webserver for my joomla page - Thank you! As a newbie I really appreciate those Step-by-Step instructions, and I like when it is explained what commands really stand for....

I exactly followed the tutorial on my vServer (Debian etch) but I got the following error after restarting Lighty

>> Starting web server: lighttpd2009-06-22 17:32:00: (mod_fastcgi.c.897) bind failed for:
>> unix:/tmp/php.socket-0 Address already in use
>> 2009-06-22 17:32:00: (mod_fastcgi.c.1330) [ERROR]: spawning fcgi failed.
>> 2009-06-22 17:32:00: (server.c.862) Configuration of plugins failed. Going down.

To solve that issue, I changed the Group of /tmp to www-data, and the permissions to 775.

bis bald,
hendrik

Submitted by Vanessa (not registered) on Fri, 2009-04-03 22:53.

really nice tutorial, howtoforge is the best tutorial page where i can find much help and answers

Submitted by Ferdie (not registered) on Wed, 2009-02-18 06:51.

To All:

I was wondering if you guys can help me with this problem in the third line of the procedures: 

mysqladmin -h myserver.homenet.com -u root password 123456

This was the error:
error: 'Lost connection to MySQL server at 'reading initial communication packet', system error: 111'

I tried changing ownership of mysql /var/run/mysqld/mysqld.sock and mysqld directory itself but still can't fix this error. I had been in debian forums and followed most of their advise and end up unfixed.

Also, how do i clean up the entire mysql-server and mysql-client packages installed in debian. I made the:

apt-get remove --purge mysql-server mysql-client

and once I reinstall again,

apt-get install mysql-server mysql-client

it looks like nothing happened becuase if I do a

netstat -tap | grep mysql

no response in the console.

could you lead me on how to fix this error.

-  Ferdie.

 

 

Submitted by Anonymous (not registered) on Tue, 2008-12-23 20:21.
Thanks, you saved my day.
Submitted by Spacemonkey (not registered) on Sun, 2008-09-28 15:58.
Someone give this person a gold star for writing the one tutorial I could find that actually worked. Excellent!
Submitted by Rebecca (not registered) on Fri, 2008-09-26 01:27.

Thanks for the awesome tutorial! It was very clear and precise.

Submitted by rtacconi (registered user) on Sun, 2007-12-09 19:38.

I have found this tutorial very nice and usefull. It will be interesting to see something more on lighttpd. For instance a tutorial on virtual hosting.

I have found a tutorial on virtual hosting here

Submitted by Anonymous@estionia (not registered) on Thu, 2009-05-21 13:49.
Thanks for help, all worked fine