apache,mysql,php,ucd-snmp£¬phpMyadmin seamless integration under linux platform
Written by liaoliang
Prelude:This article is originted from liaoliang,you can copy/post it freely.
But you must keep this article untouched including this preclude and the original grammer/spelling mistakes.
I am system administrator from Chinese mainland.I love linux and php programming.Because my current
work often involves router and ethernet switch manegement,i do a little reserch about snmp(simple network management protocol).I am not a linux expert,but i am linux paranoia.And i love the free
feeling of linux platform.
As a administrator,I actually do some php programming involveing snmp.And i actually think that compile snmp
support into php enviroment may be a big headache.During you cnfigure and make procedure,you alway get some
kind of compile error messages which may hurt your interst of snmp programing.Once upon a time,i surfed on net for more advices,but i seldom found anything that may be useful.
This artcle was wrriten befor redhat linux 7.3 is issued.Before redhat linux 7.3 i onwed quite a few linux versions including redhat,blue point,turbo linux.To my disappoited i found no integrated snmp module of php lamguage in those production.Yes,I know redhat 7.3 integrates snmp packet into their php enviroment.In fact ,now,you can simply install a redhat 7.3 to support your snmp programming.I acknowlege i have installed 7.3 on my hardisk.
But i will still think this article may help you.becuase when i surf on phpbuilder.com,i still see someone
post some article titled "How to compile snmp...."I hope my exprience will do some help.
But i still think the ability that you can compile other's code is just some knowlege,not technology.If you want to be an expert,you need some knowlege,and more and more technology.Maybe programming under an already bulit programming enviroment requires more technology,at least i think so.
I am not a good english language leaner.Acutally i seldom post articles on net,especially in english.If you find this article is useful,please keep it untouched like its original look,including this preclude.
If you have any questions/advices about this tutorial.Just email to me via liaoliang@371.net.
(This preculude was written on 8,1,2002)
apache,mysql,php,ucd-snmp£¬phpMyadmin seamless integration under linux platform
written by liaoliang,first completed in chinese before rh 7.3 is issued.
I donnot guarantee my expience is fit to you.If it cuases any damages,it is your problem,not mine. 🙂
The following procedual is tested successfully on redhat linux 6.2 platform.
We need the following source packes.(You can test other version of those packes,but i have not tested them. But i think it ususally will works .)
apache_1.3.20.tar.gz
mysql-3.23.40.tar.gz
php-4.0.5.tar.gz
phpadmin.tar.gz
ucd-snmp-4.2.3.tar.gz
Step 1
Copy those packet into a directory, for example, /home/liang,the issue tar command to extract them.
#cd /home/liang/
tar xvzf apache_1.3.20.tar.gz
tar xvzf mysql-3.23.40.tar.gz
tar xvzf php-4.0.5.tar.gz
tar xvzf ucd-snmp-4.2.3.tar.gz
Step 2
In this step,our target is installing Mysql database.We will install it into /usr/local/mysql directory.(Before you install it,this directory does not exist.)
cd mysql-3.23.40
#./configure --prefix=/usr/local/mysql
#make
#make install
After you have done it,use the fowlling shell script to initiate your Mysql database,It will initiate
system database like db, host, user, tables_priv, columns_priv
/home/liang/mysql-3.23.40/scripts/mysql_install_db
Then run MYSQL server like this:
/usr/local/mysql/bin/safe_mysqld &
/usr/local/mysql/bin/mysqladmin -u root password "new-password" ---It will define database access password.
Use the following command to show dabase:
/usr/local/mysql/bin/mysqlshow ¨Cp
+---------------+
| Databases |
+---------------+
| mysql |
+---------------+
/usr/local/mysql/bin/mysql -u root -p
mysql> show databases;
+----------------+
| Database |
+----------------+
| mysql |
| test |
+----------------+
If you have seen that,you MYSQL server is OK.
Step 3
Now we will install ucd-snmp packet.It's codes comes from Carnegie-maron university.Becuase PPH will invoke
it's APIs to support its own snmp functions,we must install ucd-snmp before installing php packet.
We first copy those packes to /usr/local/ucd-snmp.Then do the following procedure.
cd /home/liang/ucd-snmp-4.2.3
./configure ¨Cprefix=/usr/local/ucd-snmp
make
make install
This step is finished.
Now our following target is compilling php into a apache module.Then install apache server.
Step 4
We must first configure apache,but not install it.We will install it later.
cd apache_1.3.20
./configre
(Notice😃o not do "make" and "make install" here.After the configuration of apache,we must install php first )
Step5
cd /home/liang/php-4.0.5
./configure --with-mysql=/usr/local/mysql --with-apache=../apache_1.3.20 \
--with-snmp=/usr/local/ucd-snmp \
--enable-track-vars
Using --enable-track-vars option can enable php's ability to trace http enriroment variables.
(i of course do some web programming,but i seldom trace a http vriables.You may give me some tips about tracing a
http variable here. 🙂 )
Using ¡ªwith-xxxxx option enable php's ability to know the information about other soft packes.
Then make and make install it.
#make
#make install
Copy ini php to lib directory.
cp ./php.ini-dist /usr/local/lib/php.ini
You can also edit php.ini file to costum your own favorite.For example,define max_execution_time option.
Notice: php3 users copy the neccessary file to php3.ini not php.ini
cp ./php.ini-dist /usr/local/lib/php3.ini
Step 6
This is the time to configure,make,make install apache server.
cd /home/liang/apache_1.3.20
./configure --activate-module=src/modules/php4/libphp4.a \
--enable-module=php4 \
--prefix=/usr/local/apache
#make
#make install
The edit usr/local/apache/conf/httpd.conf
And for PHP 4.x, use:
---> AddType application/x-httpd-php .php
---> AddType application/x-httpd-php-source .phps
Step 7
Test apache server:
cd /usr/local/apache/bin
./apachectl configtest
Syntax OK
./apachectl start
./apachectl start: httpd started
then define web index file
#
DirectoryIndex: Name of the file or files to use as a pre-written HTML
directory index. Separate multiple entries with spaces.
#
<IfModule mod_dir.c>
DirectoryIndex index.html index.htm index.shtml index.php index.php4 index.php3 index.cgi
</IfModule>
At last we use phpMyAdmin to be database's client side management platform.
cp /home/liang/phpadmin.tar.gz
cd /usr/local/apache/htdocs
tar xvzf phpadmin.tar.gz
edit /usr/local/apache/htdocs/phpMyAdmin/config.inc.php3
$cfgServers[1]['password'] = 'password of MYSQL'
It will be ok.
---this is the end of this article--------