menembus batas impian

Archive for the ‘Apache PHP’ Category

instal php tambahan


Installing PHP with Slackware Linux

Slackware Linux, Apache2, PHP, Build Apache
cd /downloads
Create apache user and group if they don’t already exist:
groupadd apache
useradd -g apache -d /dev/null -s /bin/false apache
wget latest source from http://httpd.apache.org
tar zxvf httpd-2.2.3.tar.gz
cd httpd-2.2.3
./configure –prefix=/usr/local/apache –enable-mods-shared=most –enable-deflate –enable-ssl
make
make install
echo “/usr/local/apache/lib” >> /etc/ld.so.conf
ldconfig
cd /usr/local/apache/conf
mkdir ssl.crt ssl.key ssl.csr
openssl req -new -out server.csr
openssl rsa -in privkey.pem -out server.key
openssl x509 -in server.csr -out server.crt -req -signkey server.key -days 365
rm privkey.pem
mv server.crt ssl.crt/
mv server.key ssl.key/
mv server.csr ssl.csr/
edit httpd.conf and do the following:
Change User and Group to “apache”
Uncomment “Include conf/extra/httpd-default.conf”
Uncomment “Include conf/extra/httpd-ssl.conf”
edit extras/httpd-ssl.conf and change the following (the paths don’t have the ssl.* directories by default):
SSLCertificateFile /usr/local/apache/conf/ssl.crt/server.crt
SSLCertificateKeyFile /usr/local/apache/conf/ssl.key/server.key
echo “/usr/local/apache/bin/apachectl start” >> /etc/rc.d/rc.local
/usr/local/apache/bin/apachectl start
go to http://your_server and https://your_server to make sure Apache is working on both ports 80 and 443# chmod +x /etc/rc.d/rc.httpd# /etc/rc.d/rc.httpd start

—————————————————————————–
Build PHP
cd /downloads
wget latest source from http://www.php.net
tar zxvf php-5.1.4.tar.gz
cd php-5.1.4
./configure –prefix=/usr/local –with-config-file-path=/etc –with-apxs2=/usr/local/apache/bin/apxs –with-mysql=/usr/local/mysql –with-mysql-sock=/var/run/mysql/mysql.sock –with-mysqli=/usr/local/mysql/bin/mysql_config –with-openssl –enable-ftp –disable-debug –enable-memory-limit –enable-inline-optimization –enable-magic-quotes –enable-mbstring –enable-track-vars –enable-xml –with-dom –with-xml –enable-sockets –with-zlib –with-gettext –with-pear –with-apsell
make
make install
cp php.ini-recommended /etc/php.ini
Vi /etc/php.ini and do the following:
change “short_open_tag” to On
change include_path to “.:/usr/local/lib/php”
edit /usr/local/apache/conf/httpd.conf and do the following:
make sure install added “LoadModule php5_module modules/libphp5.so”
add “index.php” to DirectoryIndex directive
add “AddType application/x-httpd-php .php .inc .class” to the end of the file
/usr/local/apache/bin/apachectl restart
echo “” > /usr/local/apache/htdocs/test.php
go to http://your_server/test.php and see if your PHP is working

see this

II) Downloading PHP
You can download from one of the PHP mirrors. (PHP comes in both gzip and bzip2 archives. This document assumes the bzip2 type.)
In bzip2 form, PHP 5.2.x is around 9 MB, so if you’re using dial-up this will take a while.
As of the time of this writing, the current PHP is version 5.2.9, so the file you get is called php-5.2.9.tar.bz2 or something similar.
Just store this somewhere that Linux can see it.
III) Installing PHP
cd to wherever you want the PHP source to live and extract it:cd /usr/srctar jxf /where_php_tarfile_is/php-5.2.9.tar.bz2
Change to the PHP top directory:cd /usr/src/php-5.2.9
Configure PHP:(This assumes that Apache is installed in /home/httpd. If it’s not there, you’ll need to figure out where apxs lives.)./configure –with-mysql –with-apxs2=/home/httpd/bin/apxs
(NOTE: Apache must be installed with mod_so enabled.)
Assuming there are no error messages from configure, it’s time to make and install PHP. Just type:make ; make install
Now, we need a php.ini file to tell PHP how to act. I just use php.ini-recommended with one change.
First, put php.ini in the default location:cp php.ini-recommended /usr/local/lib/php.ini
The only change I make is to turn off allow_url_fopen:allow_url_fopen = Off
(NOTE: In the wrong hands, allow_url_fopen can be very dangerous! I write PHP code to avoid its use.)
All that’s left to do is modify the Apache configuration file: /home/httpd/conf/httpd.conf by adding the line:AddType application/x-httpd-php .php
While you’re there, you may want to add .php indexes to the DirectoryIndex line:DirectoryIndex index.html index.php index.shtml
To make it all work, stop the web server:/etc/rc.d/rc.httpd stop
Then start it again:/etc/rc.d/rc.httpd start

install php on slackware


I) What you need

A Slackware Linux box on which you can log on as root.
The Apache web server must be installed with mod_so enabled. (For more information, see my Apache install directions.)
Some type of Internet access (to download the PHP source).
About half an hour of uninterrupted work time.

II) Downloading PHP

You can download from one of the PHP mirrors. (PHP comes in both gzip and bzip2 archives. This document assumes the bzip2 type.)

NOTE: PHP 5.3 is out. I’m still using 5.2, due to issues with some of the Drupal modules we use.

In bzip2 form, PHP 5.2.x is around 9 MB, so if you’re using dial-up this will take a while.

As of the time of this writing, the current 5.2.x branch PHP is version 5.2.13, so the file you get is called php-5.2.13.tar.bz2 or something similar.

Just store this somewhere that Linux can see it.

III) Installing PHP

cd to wherever you want the PHP source to live and extract it:
cd /usr/src
tar jxf /where_php_tarfile_is/php-5.2.13.tar.bz2

Change to the PHP top directory:
cd /usr/src/php-5.2.13

Configure PHP:
(This assumes that Apache is installed in /home/httpd. If it’s not there, you’ll need to figure out where apxs lives.)
./configure –with-mysql –with-apxs2=/home/httpd/bin/apxs

(NOTE: Apache must be installed with mod_so enabled.)

Assuming there are no error messages from configure, it’s time to make and install PHP. Just type:
make ; make install

Now, we need a php.ini file to tell PHP how to act. I just use php.ini-recommended with one change.

First, put php.ini in the default location:
cp php.ini-recommended /usr/local/lib/php.ini

The only change I make is to turn off allow_url_fopen:
allow_url_fopen = Off

(NOTE: In the wrong hands, allow_url_fopen can be very dangerous! I write PHP code to avoid its use.)

All that’s left to do is modify the Apache configuration file: /home/httpd/conf/httpd.conf by adding the line:
AddType application/x-httpd-php .php

While you’re there, you may want to add .php indexes to the DirectoryIndex line:
DirectoryIndex index.html index.php index.shtml

To make it all work, stop the web server:
/etc/rc.d/rc.httpd stop

Then start it again:
/etc/rc.d/rc.httpd start

Back to Stu’s Linux page

instal apache on slacware


I) What you need

A box with Slackware Linux installed and running.
Some type of Internet access.
About half an hour of uninterrupted work time.
To boot the above-mentioned machine and log on as root.

II) Downloading Apache Web Server

You can download directly from the Apache site (http://httpd.apache.org/) or you may want to try one of the mirrors close to you to get a faster download.

Apache v2.2 is about 5 MB, so if you’re using dial-up this will take a while.

As of the time of this writing the current Apache web server is version 2.2.15, so the file you get is called httpd-2.2.15.tar.bz2 or something similar.

Just store this somewhere that Linux can see it.

III) Installing Apache web server

cd to wherever you want the apache source to live and extract it:

cd /usr/src
tar -jxf /where_apache_tarfile_is/httpd-2.2.15.tar.bz2

Change to the Apache top directory:

cd /usr/src/httpd-2.2.15

Now, configure Apache:
(This assumes that we’re installing Apache in /home/httpd. You can install it anywhere you wish by replacing /home/httpd with your location of choice.)

./configure –prefix=/home/httpd –enable-modules=so

(NOTE: I’ve included the module so, which makes it easier to add stuff like PHP.)

So far we’re doing good. Let’s make a web server! Just type:

make ; make install

This will make the server and install it in one fell swoop. On my test box (an Athlon 600 ) this takes under two minutes. Your mileage may vary!

You should get a box that says:

You now have successfully built and installed the Apache 2.2 HTTP server . . .

If so, we only have a few steps left! If not, you’ll need to start reading the error messages and the Apache documentation to figure out what went wrong.

If you’d like Apache to use something other than (or in addition to) index.html as an index page, Just edit the file /home/httpd/conf/httpd.conf and find the section labeled DirectoryIndex and add to the line that looks like:

DirectoryIndex index.html

You can add as many as you like, but I must mention that each one is an additional lookup each time a directory is accessed without a file name. Too many may slow your server down. Anyway, my line looks something like:

DirectoryIndex index.html index.php index.shtml index.htm default.htm

You may need to create rc.httpd in /etc/rc.d:
(This location is for Slackware; you may need a different location for other Linux distributions.)

It should look something like:

#!/bin/sh
if [ “$1” = “stop” ]; then
/home/httpd/bin/apachectl stop
elif [ “$1” = “restart” ]; then
/home/httpd/bin/apachectl restart
elif [ “$1” = “start” ]; then
/home/httpd/bin/apachectl start
else
echo “usage: $0 start|stop|restart”;
fi

Then change it so that it can be executed:

chmod a+x rc.httpd

A reboot of your system should have you on your way. If you don’t wanna restart, just type:

/etc/rc.d/rc.httpd start

If you can see the page: http://your_server/ then your installation was successful!

Some random Apache notes

Back to Stu’s Linux page

last updated 03-29-2010 07:16 by Stuart Reedy
Copyright Stuart Reedy 2002-2010
All rights reserved

Install Tomcat 7 on Ubuntu 10.10 and Ubuntu 10.04


Apache has officially launched version 7.0 of the servlet container for Java applications, Tomcat. Major changes in this version, you can highlight support for Servlet 3.0 and JavaServer Pages 2.2.

Install JDK
See this post: Install JDK 6 update 23 in Ubuntu 10.10

Installation

The first thing to do is download the package “apache-tomcat-7.0.6.tar.gz” from the NEXT link

http://tomcat.apache.org/download-70.cgi [tar.gz]

Now unpack it with the following command:

tar xvzf apache-tomcat-7.0.8.tar.gz

Then we let in a more appropriate directory, in our case in / usr/share/tomcat7, but can be in any directory. We do this with the command:

sudo mv apache-tomcat-7.0.8/ /usr/share/tomcat7

Now we define the environment variables JAVA_HOME and JRE_HOME. This file is in the “environment” in / etc. Command to edit the file:

sudo gedit /etc/environment

Here we record the routes where we have installed Java in my case this is as follows:

JAVA_HOME=”/usr/local/jdk1.6.0_23″
JRE_HOME=”/usr/local/jdk1.6.0_23/jre”
PATH=”…(other path):$JAVA_HOME:$JRE_HOME”

IMPORTANT: Verify the routes where they have installed Java.

I have had some problems in defining these environment variables, as sometimes tomcat does not recognize, but a surefire way of recognizing that tomcat is to define the file paths inside “catalina.sh”located in tomcat7/bin. To modify this file use the command:

sudo gedit /usr/share/tomcat7/bin/catalina.sh

Now just insert the JAVA_HOME and JRE_HOME after the first line, so the file is as follows:

#!/bin/sh
JAVA_HOME=”/usr/local/jdk1.6.0_23″
JRE_HOME=”/usr/local/jdk1.6.0_23/jre”
# Licensed to the Apache Software Foundation (ASF)…
#…
#…
….

Now let’s configure Tomcat users, this is done in the file “tomcat-users.xml”directory tomcat7/conf. Command to edit the file:

sudo gedit /usr/share/tomcat7/conf/tomcat-users.xml

Unlike previous versions where the administrator should own role “manager” now it should be “manager-gui”to operate on the web administration tomcat7. The file would be as follows:

Now you should be all ready to try tomcat7.

First we must lift the server with the following command:

sudo /usr/share/tomcat7/bin/startup.sh

With this we get the following output on console:

Using CATALINA_BASE: /usr/share/tomcat7
Using CATALINA_HOME: /usr/share/tomcat7
Using JRE_HOME: /usr/local/jdk1.6.0_20/jre
Using CLASSPATH: /usr/share/tomcat7/bin/bootstrap.jar:/usr/share/tomcat7/bin/tomcat-juli.jar

Verify that the JRE_HOME is where we define.

Now open your web browser and type the following url:

http://127.0.0.1:8080/

So we get the following page:

If we enter the administration Tomcat Manager we click on the menu or directly at URL:

http://127.0.0.1:8080/manager/html

Here we ask the user data from previous record in mind tomcat-users.xml.

I recommend testing the sample to make sure everything works ok, they are in the section “Miscellaneous” from the side menu or at the URL:

http://127.0.0.1:8080/examples/

Commands

Start server:

sudo /usr/share/tomcat7/bin/startup.sh

Stop server:

sudo /usr/share/tomcat7/bin/shutdown.sh

Automatic Starting

To make tomcat automatically start when we boot up the computer, you can add a script to make it auto-start and shutdown.

sudo gedit /etc/init.d/tomcat7

Now paste in the following:

# Tomcat auto-start
#
# description: Auto-starts tomcat
# processname: tomcat
# pidfile: /var/run/tomcat.pid

case $1 in
start)
sh /usr/share/tomcat7/bin/startup.sh
;;
stop)
sh /usr/share/tomcat7/bin/shutdown.sh
;;
restart)
sh /usr/share/tomcat7/bin/shutdown.sh
sh /usr/share/tomcat7/bin/startup.sh
;;
esac
exit 0

You’ll need to make the script executable by running the chmod command:

sudo chmod 755 /etc/init.d/tomcat7

The last step is actually linking this script to the startup folders with a symbolic link. Execute these two commands and we should be on our way.

sudo ln -s /etc/init.d/tomcat7 /etc/rc1.d/K99tomcat
sudo ln -s /etc/init.d/tomcat7 /etc/rc2.d/S99tomcat

Tomcat should now be fully installed and operational. Enjoy!

sudo /etc/init.d/tomcat7 restart

from : http://diegobenna.blogspot.com/2011/01/install-tomcat-7-in-ubuntu-1010.html

Menampung multi domain dalam satu public IP address di ubuntu


Menampung multi domain dalam satu public IP address di ubuntu

Tempat saya belajar bekerja memiliki sebuah komputer server yang memiliki sebuah IP public, Beberapa domain diharapkan bisa ditampung dalam satu IP address public tersebut. Nah masalah yang dihadapi adalah

Bagaimana cara mengkonfigurasi web server agar dapat menampung beberapa domain ?

Saya mencari jawabannya di Google dengan kata kunci multiple domain, virtual host di ubuntu dan menemukan beberapa artikel yang layak dipraktekan dan mampu membantu saya menyelesaikan pengkonfigurasian server tersebut. Saya dokumentasikan cara menampung beberapa domain dalam satu IP address atau dengan kata lain membuat virtual host dalam satu web server.

Kalau sudah biasa kerja dengan web server apache di ubuntu pasti tau kita harus mengedit file konfigurasi di mana. Sekedar mengingatkan path konfigurasi apache2 di ubuntu ada di

/etc/apache2/sites-available

Biasanya dalam direktori tersebut terdapat konfigurasi virtual host default isinya kurang lebih seperti berikut;

<VirtualHost xxx.xxx.x.xxx:80>
ServerAdmin webmaster@syridink.com

DocumentRoot /home/syridink/siiweb/syridink.com
<Directory /home/syridink/siiweb/syridink.com><
Options FollowSymLinks
AllowOverride None
</Directory>

Options -Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory /usr/lib/cgi-bin/>
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>

ErrorLog /var/log/apache2/error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog /var/log/apache2/access.log combined

Alias /doc/ “/usr/share/doc/”
<Directory /usr/share/doc/>
Options -Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
</VirtualHost>

Untuk membuat virtual host baru siapkan dulu kebutuhan sebagai berikut:

Siapkan root direktori(htdocs/httpdocs) untuk web kita misalkan di /home/najmakeysa
Buat direktori untuk menampung log misalnya di /home/najmakeysa/logs
Tentunya IP address yang akan menampung domain tersebut

Misalnya domain yang sudah kita miliki adalah http://www.sikesya.net , selanjutnya buat file konfigurasi virtualhost caranya

sudo nano /etc/apache2/sites-available/www.sikesya.net

Teks editor nano akan membuat file baru yang benar-benar kosong. Copy-paste saja kode berikut ke dalam file konfigurasi tersebut :

<VirtualHost xxx.xxx.x.xxx:80>

ServerAdmin admin@sikesya.net
Servername http://www.sikesya.net
ServerAlias sikesya.net

#Indeks + Direktori Root.
DirectoryIndex index.php index.html
DocumentRoot /home/najmakeysa

# Logfiles # Logfiles
ErrorLog  /home/najmeksya/logs/error.log
CustomLog  /home/najmakeysa/logs/access.log combined

</VirtualHost>

Agar website berdomain http://www.sikesya.net tersebut konfigurasinya enable dan diload oleh apache lakukan perintah berikut:

sudo a2ensite http://www.sikesya.net

lalu

sudo /etc/init.d/apache2 restart

Oh iya di dalam directive <VirtualHost xxx.xxx.x.xxx:80> terdapat string xxx. dst .Jangan lupa ganti string tersebut dengan IP address yang dikehendaki.Konfigurasi virtual hostnya sudah selesai, bila masih ada domain yang ingin ditambahkan ke dalam IP tersebut buat saja file konfigurasi lagi (dengan settingan yang berbeda tentunya).

Selamat mencoba…

http://blog.nuazul.net