- First prerequirements are a working apache2 and php7.2 (Ubunti 18.04) environment.
- Download the basic (like instantclient-basic-linux.x64-12.2.0.1.0.zip) and the sdk (instantclient-sdk-linux.x64-12.2.0.1.0.zip) package from the Oracle Website http://www.oracle.com/technetwork/database/database-technologies/instant-client/downloads/index.html
- Upload both files to your webserver, you can use WinSCP (windows) or rsync/scp (linux) for it
- Unzip both files on server, in my case, you will get a new folder named "instantclient_12_2"
- Create destination folder : mkdir /opt/oracle
- Move and rename the instantclient folder: mv instantclient_12_2 /opt/oracle/instantclient
- Change rights on folder: chown -R root:www-data /opt/oracle
- Check if you have the required packages for installing OCI8: apt install php7.2-dev php-pear build-essential libaio1
- Create necessary soft links: ln -s /opt/oracle/instantclient/libclntsh.so.12.1 /opt/oracle/instantclient/libclntsh.so; ln -s /opt/oracle/instantclient/libocci.so.12.1 /opt/oracle/instantclient/libocci.so
- Add instant client to ld config files : echo /opt/oracle/instantclient > /etc/ld.so.conf.d/oracle-instantclient.conf
- Update Dynamic Linker Run-Time Bindings : ldconfig
- Now install OCI8 by pecl: pecl install oci8
- The OCI8 installation is asking you for the right folder: instantclient,/opt/oracle/instantclient
- Add oci lib to the cli php config (console php): echo "extension = oci8.so" >>/etc/php/7.2/cli/php.ini
- Add oci lib to the apache php config: echo "extension = oci8.so" >> /etc/php/7.2/apache2/php.ini
- Set environment variables for the cli version (you will need to reboot the server after): echo "LD_LIBRARY_PATH=\"/opt/oracle/instantclient\"" >> /etc/environment echo "ORACLE_HOME=\"/opt/oracle/instantclient\"" >> /etc/environment
- Set environement variables for the apache version: echo "export LD_LIBRARY_PATH=\"/opt/oracle/instantclient\"" >> /etc/apache2/envvars; echo "export ORACLE_HOME=\"/opt/oracle/instantclient\"" >> /etc/apache2/envvars
- Restart Apache: service apache2 restart or systemctl restart apache2
- You're done, now you can test your connection to the Oracle database
Showing posts with label apache. Show all posts
Showing posts with label apache. Show all posts
Tuesday, October 9, 2018
How to install oci8 instant client for Ubuntu Linux
Monday, May 19, 2014
Apache redirection
I want to redirect all of my users who go to www.mywebmailserver.com to webmail.mywebmailserver.com. I have learned that from my googling, there are 2 popular ways to do it in apache web server. First, by using mod_rewrite and second, I can use redirect. The latter is the simplest. So I chose it. :)
Put this in vhost container.
NameVirtualHost www.mywebmailserver.com <virtualhost www.mywebmailserver.com> ServerName www.mywebmailserver.com Redirect 301 / http://webmail.mywebmailserver.com/ </virtualhost>
In Mageia 4, the file is located in /etc/httpd/conf/vhosts.d and the file name is 00_default_vhosts.conf
That's it. Restart or reload apache for the changes to take effect.
Have fun!
Thursday, January 22, 2009
How to setup a https server with apache
Setting up an https server in Apache is easier by watching video. Don't you agree? :)
Sunday, December 24, 2006
Setting up name-based virtual host on apache
I just finished setting up name-based virtual host for one of my clients. The server is Red Hat Linux Enterprise 4 update 4 (RHEL) with public IP. After I have successfully setting up DNS server correctly in particular to access to this server, this is how I setup name-based virtual host for it.
What is name-based virtual host?
A feature for webserver (ie apache,IIS etc) to serve many websites with one IP. The server will serve webpages accordingly based on the name of the site (ie www.example.com , mail.example.com , blog.example.com etc2).
Let's do it.
This tip is for Red Hat and maybe the same for Fedora Core (FC). On Mandriva and other distros, the directive to change may be in different files and different folders.
Step 1
Open up /etc/httpd/conf/httpd.conf with your favorite text editor (I personally use joe in console).
Step 2
Coment out this line:
NameVirtualHost *:80
Step 3
Comment out these lines (in the VirtualHost containers and change accordingly to your server name:
ServerAdmin testuser@example.com
DocumentRoot /var/www/html/
ServerName www.example.com
ErrorLog /var/log/www.example.com.log
CustomLog /var/log/www.example.com.common.log common
ServerAdmin testuser2@example.com
DocumentRoot /var/www/html/email
ServerName mail.example.com
ErrorLog /var/log/mail.example.com.log
CustomLog /var/log/mail.example.com.common.log common
Note:
See the DocumentRoot directive in each VirtualHost container. It is different. And also see the difference of ServerName directive. It is used by Apache to differentiate the website served based on the name.
Step 4
Restart apache by issuing "service httpd restart" in console (without the double quote). Notice any error if any.
Step 5
Now you can try accessing your server with www.example.com and mail.example.com. See if it serves the right page. If yes, congratulations. You have successfully done it.
That's all there is to it. Have fun.
Thursday, July 6, 2006
Apache virtual server on SuSe 9.2

Hello there!. We meet again. :)
I am in the process of tranferring my old server files and data to our new server. It is an IBM e-series (2 Xeon CPUs, 1 GB RAM, 2 HDDs, Hardware RAID capable, 2 power supplies). I have setup SuSe Linux Professional 9.2 on it for testing. After 2 days testing it, I decided to use it as the distro of choice for our new server. SuSe is an excellent distribution for servers (so do other distributions aimed for servers). This is the article on how I setup name-based apache virtual server for the server.
Setting up apache virtual server
What is apache virtual server? It is a concept where a server can have multiple names and multiple IPs. Each server name can have different content depends on folder they are assigned (See below). The configuration on some distros is different depends on what directive have been put in httpd.conf and other files.
Copy file /etc/apache2/vhosts.d/vhost.template to vhost.conf in the same directory. Put this in /etc/apache2/vhosts.d/vhost.conf :
<**virtualhost>
ServerName www.mydomain.tld
ServerPath /mydomain
DocumentRoot /srv/www/web/domain
< /virtualhost>
<**virtualhost>
ServerName www.mydomain2.tld
ServerPath /mydomain2
DocumentRoot /srv/www/web/domain2
< /virtualhost>
(please remove the leading **)
This is one server serves multiple domains or subdomains. To configure name-based virtual hosts, uncomment this line in /etc/apache2/listen.conf:
NameVirtualHost *:80
If you are using UTF-8 in your web pages, you should replace this line in /etc/apache2/mod_mime-defaults.conf:
AddDefaultCharset ISO-8859-1
with this line:
AddDefaultCharset Off
How does apache knows to differentiate each domain/subdomain ?
It looks at the HTTP header of clients' packets. If you type http://www.mydomain.tld, it will serve for domain www.mydomain.tld and the same for the other domain. You can have as many domain as you like.
It looks at the HTTP header of clients' packets. If you type http://www.mydomain.tld, it will serve for domain www.mydomain.tld and the same for the other domain. You can have as many domain as you like.
To see the status of your bonding interface, issue this command :
~#cat /proc/net/bonding/bond0
The output is as below :
Ethernet Channel Bonding Driver: v2.6.0 (January 14, 2004)
Bonding Mode: load balancing (round-robin)
MII Status: up
MII Polling Interval (ms): 0
Up Delay (ms): 0
Down Delay (ms): 0
Slave Interface: eth0
MII Status: up
Link Failure Count: 0
Permanent HW addr: 00:14:5e:69:75:2a
Slave Interface: eth1
MII Status: up
Link Failure Count: 0
Permanent HW addr: 00:14:5e:69:75:2b
Summary
Instead of 2 servers for two purposes, I create name-based apache virtual server to serve for my domains and subdomains. This eliminates the need for more hardwares and cost. Furthermore, the server is capable enough to handle more that 1 domain and I think this is one of many ways to use the hardware effectively.
Resource
http://www.topology.org/linux/apache2.html
http://httpd.apache.org/docs/1.3/vhosts/name-based.html
Subscribe to:
Posts (Atom)
Nvidia new hotplug feature on Linux
If you use nvidia driver for your GPU, you probably wonder why in some config, you can't hotplug your second monitor. You need to reboo...
-
BASH script to load balance 2 WAN links. #!/bin/bash # # bal_local Load-balance internet connection over two local links # # Version: 1....
-
queuegraph is a very simple mail statistics RRDtool frontend for Postfix that produces daily, weekly, monthly and yearly graphs of Postfix...
-
Recently, my server's only hard disk was almost full. I bought a new hard disk with bigger size and I decided to just add it as a second...