Creating a PHP Development Server.
My StoryFirst I'm a network administrator and php developer. Not a writer. Now, Here is the tech...The content here is FREE ...
This web site is prepared and maintained by Chauncey Thorn. Installing ApacheApache has been the most popular web server on the Internet since 1996. According to server site survey by Netcraft found that over 60% of the web sites on the Internet are using Apache
Down load the latest stable release I prefer to compile Apache with Dynamic Shared Object (DSO) support, which allows me to install pretty much any module without having to recompile Apache to take advantage of it.... $ su mod_perl
# wget -U lynx ftp://sunsite.cnlab-switch.ch/mirror/CPAN/modules/by-module/Apache/mod_perl-1.24_01.tar.gz
# cd /usr/local/src
# tar -xvzf /pathto/apache-source.tar.gz
# tar -xvzf mod_perl-1.24_01.tar.gz
# cd mod_perl-1.24_01
# perl Makefile.PL \
EVERYTHING=1 \
APACHE_SRC=../apache_1.3.14/src \
USE_APACI=1 \
PREP_HTTPD=1 \
DO_HTTPD=1
# make
# make install
cd /usr/local/src/apache_1.3.14/
./configure --activate-module=src/modules/perl/libperl.a \
--enable-module=perl
make
make install
# cd apache-*
# ./configure --prefix=/home/www --enable-module=most --enable-shared=max \
--activate-module=src/modules/perl/libperl.a \
--enable-module=perl
# make && make install
# ln -s /home/www/bin/apachectl /etc/rc.d/init.d/httpd
# vi /home/www/bin/apachectl
i
chkconfig:
Description: Start/Stop Apache W3 Server
shift : qw
# /sbin/chkconfig --del httpd
# /sbin/chkconfig --add httpd
Modify your /home/www/conf/httpd.conf
Port 80
DirectoryIndex index.html index.php3 index.phtml index.php
For PHP3
AddType application/x-httpd-php3 .php3 .phtml .php
For PHP4
AddType application/x-httpd-php .php3 .phtml .php
Test your Apache Setup
# /etc/rc.d/init.d/httpd start
# ps ax | grep httpd
Apache with mod_ssl
Get the latest versions of mod_ssl andsl
# cd /usr/local/src
# tar -xvzf /path/to/sl-xx.tar.gz
# tar -xvzf /path/to/mod_ssl-xx.tar.gz
# cdsl-xx
# ./config -fPIC
# make
# make install
# cd ../mod_ssl-xxx
# ./configure -with-apache=../apache-1.3.xx
# cd ../apache-1.3.xx
# SSL_BASE=../sl-xx ./configure --prefix=/home/www \
--enable-module=most --enable-shared=max \
--enable-module=ssl --enable-shared=ssl \
--activate-module=src/modules/perl/libperl.a \
--enable-module=perl
# make
# make certificate
# make install
Test your Apache Setup
# /etc/rc.d/init.d/httpd stop
# /etc/rc.d/init.d/httpd startssl
# enter phrase
# ps ax | grep httpd
Apache Virtual Hosting cfg IP-based Virtual Hosting <VirtualHost name1.mydomain.com> DocumentRoot /usr/local/apache/name1_www ServerName name1.mydomain.com ErrorLog /usr/local/apache/logs/name1_logs/error_log TransferLog /usr/local/apache/logs/name1_logs/access_log </VirtualHost> <VirtualHost name2.mydomain.com> ServerAdmin webmaster DocumentRoot /usr/local/apache/name2_www ServerName name2.mydomain.com ServerAlias name2 </VirtualHost> <VirtualHost name3.mydomain.com> DocumentRoot /usr/local/apache/name3_www ServerName name3.mydomain.com ScriptAlias /use/local/apache/name3_cgi </VirtualHost> NameVirtualHost <VirtualHost > ServerName name1.mydomain.com DocumentRoot /usr/local/apache/name1docs ServerAlias name1 </VirtualHost> <VirtualHost > ServerName name2.mydomain.com DocumentRoot /usr/local/apache/name2docs ServerAlias name2 </VirtualHost> <VirtualHost > ServerName name3.mydomain.com DocumentRoot /usr/local/apache/name3docs ServerAlias name3 </VirtualHost> Installing MySQLMySQL is my DEFAULT development database. I've used PostgreSQL, however others PHP developers as well as myself prefer MySQL because its VERY fast for Web Based applications.
Down load the latest stable release or the developement version. I usually get the stable releases. $ su # adduser mysql # cd /usr/local # tar -xvzf /pathto/mysqlsrc/mysql-3.22*gz # mv mysql* mysql # cd mysql # ./configure # make && make install # scripts/mysql_install_db # cp support-files/mysql.server /etc/rc.d/init.d/mysql # modify /etc/rc.d/init.d/mysql (Change the user root to mysql) # chmod +x /etc/rc.d/init.d/mysql # /sbin/chkconfig --del mysql # /sbin/chkconfig --add mysql # chown -R mysql:mysql /usr/local/var/* # /etc/rc.d/init.d/mysql start # mysqladmin -uroot password 'newpassword' <-- CHANGE the root password # Example commandline # # CREATE DB: mysqladmin create databasename -p # VIEW DBs : mysql -e 'SHOW DATABASES' -p # SELECT DATA : mysql databasename -e 'SELECT * from user WHERE User = "root"' # Backing UP DB: mysqldump --opt databasename > /path/to/dbbackups/dd-mm-yy.database.mysql # CREATE a NEW DB from and OLD one: # mysqladmin create newdb -p # mysqldump --opt olddb -p | mysql newdb -p # SQL statement in a text file: mysql databasename < SQLstatement_file.mysql -p # LOOK at DB structure: mysqlshow databasename -p # mysqlshow databasename tablename -p # DROP olddb: mysqladmin -p drop databasename # Status of DB server: mysqladmin status -p # SHUTDOWN DB: mysqladmin -p shutdown # DOING Increment backups: run the mysqld with the --log-update Install PHPDownload the lastest 3.0.16 or PHP4.x
$su
# cd /usr/local/src
# tar -xvzf /pathto/php-3.0.16*
# cd php-3*
# vi makephp <-- Create shell script called makephp with vi
i <--- to insert
#!/bin/sh
./configure --with-mysql --with-gd --with-zlib \
--with-system-regex --enable-track-vars \
--with-apxs=/home/www/bin/apxs
# Add these options if you want use the functions
#
# --with-ftp #FTP Support
# --with-mcal=/usr/local/libmcal # MCAL Support (Calendar(s))
# --with-pgsql #PostgreSQL Support
# --with-imap #IMAP Support (Twig and phpGroupWare)
# --with-snmp --enable-ucd-snmp-hack #SNMP Support (PHP/SNMP Network Tool)
<--- Hit your ESC key
shift :wq
# chmod +x makephp
# ./makephp
# make && make install
# /etc/rc.d/init.d/httpd restart
Getting mod_dav installed
What is mod_dav? # ./configure --with-apache=/home/www/bin/apxs # make && make install # vi /home/www/conf/httpd.conf Scroll down to the bottom i DAVLOCKDB /usr/local/apache/var/DAVLock DAVMinTimeout 600 < LOCATION /deptname > DAV on < /LOCATION > shift : wq # mkdir /usr/local/apache # mkdir /usr/local/apache/var # chown nobody:nobody /usr/local/apache/var # /etc/rc.d/init.d/httpd restartHOME |