note 90110 added to install.unix.apache2
| From: | YinXiaofeng at osu1 dot php dot net | Date: | Tue, 07 Apr 2009 06:55:35 +0000 |
| Subject: | note 90110 added to install.unix.apache2 | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-152879@lists.php.net to get a copy of this message | ||
only for learner, or be stricted user under unix-like (for example, BSDs) environment
===***===
make working directory, you can change these path you want
===***===
> cd /home/httpd
> ls -ld /home
lrwxr-xr-x 1 root wheel 8 Feb 25 21:50 /home -> usr/home
> pwd
/usr/home/httpd
===***===
download tarballs
===***===
> ls *tar*
httpd-2.2.11.tar.gz perl-5.8.9.tar.gz
mysql-5.1.31.tar.gz php-5.2.8.tar.bz2
===***===
compile perl (required by apache's apxs)
===***===
> tar -x -z -f perl-5.8.9.tar.gz
> cd perl-5.8.9
(read INSTALL for instructions)
> sh Configure (alter prefix path to '/home/httpd/perl5')
> make
> make test (optional)
> make install
(add perl executable to PATH environment)
> setenv PATH /home/httpd/perl5/bin:$PATH
> which perl
/home/httpd/perl5/bin/perl
===***===
install apache
===***===
> tar -x -z -f httpd-2.2.11.tar.gz
> cd httpd-2.2.11
> ./configure --prefix=/home/httpd/apache --enable-so
> make
> make install
> head -2 /home/httpd/apache/bin/apxs (modify perl interpreter path
#!/home/httpd/perl5/bin/perl -w
instead of
#!/replace/with/path/to/perl/interpreter -w)
===***===
install mysql
===***===
> tar -x -z -f mysql-5.1.31.tar.gz
> cd mysql-5.1.31
> ./configure --prefix=/home/httpd/mysql51
> make
> make install
> cp support-files/my-medium.cnf /home/httpd/mysql51/my.cnf (comment out
> 'skip-federated')
> cd /home/httpd/mysql51
> bin/mysql_install_db --user=mgr (--user=<normal user>, eg: mgr)
> bin/mysqld_safe --user=mgr &
> bin/mysql -u root -p
mysql> set password for 'root'@'localhost' = password('mysql');
mysql> use mysql;
mysql> delete from user where password = '';
mysql> flush privileges;
mysql> select host,user,password from user;
+-----------+------+-------------------------------------------+
| host | user | password |
+-----------+------+-------------------------------------------+
| localhost | root | *E74858DB86EBA20BC33D0AECAE8A8108C56B17FA |
+-----------+------+-------------------------------------------+
1 row in set (0.00 sec)
mysql> quit;
===***===
install php
===***===
> tar -x -j -f php-5.2.8.tar.bz2
> cd /home/httpd/php-5.2.8
> ./configure --prefix=/home/httpd/php5 \
? --disable-all \
? --enable-session \
? --enable-json \
? --with-apxs2=/home/httpd/apache/bin/apxs \
? --with-mysql=/home/httpd/mysql51
> make
> make install
> cp php.ini-dist /home/httpd/php5/lib/php.ini
> /home/httpd/php5/bin/php -m
[PHP Modules]
date
json
mysql
pcre
Reflection
session
standard
[Zend Modules]
>
===***===
config apache (httpd.conf)
===***===
> cd /home/httpd/apache
> diff conf/httpd.conf conf/original/httpd.conf
40c40
< Listen 2080
---
> Listen 80
53d52
< LoadModule php5_module modules/libphp5.so
55,57d53
< <FilesMatch \.php$>
< SetHandler application/x-httpd-php
< </FilesMatch>
===***===
test all things
===***===
> cat htdocs/a.php
<?php session_start(); ?>
<?php phpinfo(); ?>
<?php
$link = mysql_connect('localhost', 'root', 'mysql');
mysql_select_db('mysql', $link);
$rs = mysql_query("select host,user,password from user");
while ($row = mysql_fetch_assoc($rs)) {
$json[] = $row;
}
echo json_encode($json);
echo session_id();
mysql_close($link);
?>
(restarting apache, then visit a.php with browser)
----
Server IP: 222.73.227.205
Probable Submitter: 121.232.37.76
----
Manual Page -- http://www.php.net/manual/en/install.unix.apache2.php
Edit -- https://master.php.net/note/edit/90110
Del: integrated -- https://master.php.net/note/delete/90110/integrated
Del: useless -- https://master.php.net/note/delete/90110/useless
Del: bad code -- https://master.php.net/note/delete/90110/bad+code
Del: spam -- https://master.php.net/note/delete/90110/spam
Del: non-english -- https://master.php.net/note/delete/90110/non-english
Del: in docs -- https://master.php.net/note/delete/90110/in+docs
Del: other reasons-- https://master.php.net/note/delete/90110
Reject -- https://master.php.net/note/reject/90110
Search -- https://master.php.net/manage/user-notes.php