Installing PHP OCI8 Extension on Mac OSX(10.11.6)

  1. Installed or Verified that Homebrew is installed on your Mac. If hasn’t installed yet, open terminal and paste command which is written on the actual Homebrew website
  2. Install the PEAR package manager to run PECL.
  3. Download these files from Oracle website

    instantclient-basic-macos.x64-11.2.0.3.0.zip
    instantclient-sqlplus-macos.x64-11.2.0.3.0.zip
    instantclient-sdk-macos.x64-11.2.0.3.0.zip

  4. Create and unzip all theses files into a the directory `/usr/local/instantclient/12_1/`.
    This directory will looks like:
  5. Create Symbolic link

    ln -s /usr/local/instantclient/12_1/sdk/include/*.h /usr/local/include/
    ln -s /usr/local/instantclient/12_1/sqlplus /usr/local/bin/
    ln -s /usr/local/instantclient/12_1/*.dylib /usr/local/lib/
    ln -s /usr/local/instantclient/12_1/*.dylib.11.1 /usr/local/lib/
    ln -s /usr/local/lib/libclntsh.dylib.11.1 /usr/local/lib/libclntsh.dylib

  6. Test with sqlplus instantclientsqlplus username/password@xfwapo-ch2-01s.sys.abc.net:1521/test
  7. Install extension with pecl
  8. If the script prompt you to provide the path to ORACLE_HOME directory, respond with:/usr/local/instantclient/12_1
    And your are done, normally pecl will automatically load the extension in your `php.ini`. If not, add the following line to your `php.ini`:
    extension=oci8.so
  9. Restart your HTTP Server and test.
  10. Enjoy

Below links for more reference:

http://pear.php.net/manual/en/installation.getting.php

https://antistatique.net/fr/nous/bloggons/2013/03/25/install-php-oracle-oci-extension-11-2-on-mac-os-x-10-8

http://www.oracle.com/technetwork/articles/dsl/technote-php-instant-084410.html

http://pear.php.net/manual/en/installation.getting.php

https://jason.pureconcepts.net/2012/10/install-pear-pecl-mac-os-x/

Posted in Others | Tagged , | Comments Off on Installing PHP OCI8 Extension on Mac OSX(10.11.6)

Installing OCI8 on the CentOS

    1. Download the RPM instant client package from oracle website. Since it is Linux environment, use the this oracle linkInstall the RPMs as the root user
      rpm –ivh  oracle-instantclient12.1-basic-12.1.0.2.0-1.x86_64.rpm
      rpm –ivh  oracle-instantclient12.1-devel-12.1.0.2.0-1.x86_64.rpm
      rpm –ivh oracle-instantclient12.1-sqlplus-12.1.0.2.0-1.x86_64.rpm
    2. Install some prerequisite

yum install php-pear
yum install php-devel

  1. Set environment variables ORACLE_HOME and LD_LIBRARY_PATH# ORACLE_HOME=/usr/lib/oracle/12.1/client64; export ORACLE_HOME
    # LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATHYou should also add the above two lines in ~/.bash_profile file. Edit the file by vi editor and add the lines above PATH=$PATH:$HOME/bin#vim  ~/.bash_profile

    # .bash_profile
    # Get the aliases and functions
    if [ -f ~/.bashrc ]; then
    . ~/.bashrc
    fi# User specific environment and startup programsORACLE_HOME=/usr/lib/oracle/12.1/client64; export ORACLE_HOME
    LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH
    PATH=$PATH:$HOME/binexport PATH

     

  2. Check you have php-pear and php-devel packages installed by this command. You must have these package installed
    1. # rpm -qa | grep -i php
    2. php-5.3.3-3.el6_1.3.x86_64
    3. php-cli-5.3.3-3.el6_1.3.x86_64
    4. php-devel-5.3.3-3.el6_1.3.x86_64
    5. php-common-5.3.3-3.el6_1.3.x86_64
    6. php-mysql-5.3.3-3.el6_1.3.x86_64
    7. php-soap-5.3.3-3.el6_1.3.x86_64
    8. php-pear-1.9.4-4.el6.noarch
    9. php-gd-5.3.3-3.el6_1.3.x86_64
  3.  Install oci8 installation# pecl install oci8
  4. if you unable to install above command, try to download latest version of PECL according to your PHP version
  5. create ‘src’ directory under /user/local
  6. use scp command#scp -r /Users/aoza002c/Desktop/CentOS/1/oci8-2.1.3/    root@xfwappa-ho-01q.sys.comcast.net:/usr/local/src/# cd /user/local/src/oci8-2.1.3
    #phpize
    #./configure –with-oci8=shared,instantclient,/usr/lib/oracle/12.1/client64/lib/
    #make install
  7. if you see below fatal error
    #export PHP_DTRACE=yes
  8. Add the folowing configuration at the end of php.ini#vi /etc/php.ini
    extension=oci8.so
  9. Restart Apache #service httpd restart

Below links for more reference:

http://techinfobest.com/install-oci8/

http://php.net/manual/en/oci8.installation.php

http://antoine.hordez.fr/2012/09/30/howto-install-oracle-oci8-on-rhel-centos-fedora/

http://techinfobest.com/connect-oracle-database-from-php-in-redhatcentos/

http://bytefreaks.net/applications/oracle/installing-oracle-sqlplus-on-centos

Posted in Others | Tagged , | Leave a comment

Best Public Cloud services – Amazon Web Services Vs Microsoft Azure Vs Rackspace

Public cloud services fall under three general categories:
– Infrastructure-as-a-Service (IaaS),
– Platform-as-a-Service (PaaS)
– Software-as-a-Service (SaaS).

In all cases, the vendors make those resources available over a public network such as the internet for an ongoing usage fee.

IaaS vendors offer servers, storage and other key aspects of computing environments using pooled shared physical resources.

PaaS vendors offer a development environment to application developers, including operating system, programming-language execution environment, database, and web server.

SaaS vendors supply a particular piece of software and/or databases via the internet.

Amazon AWS organizes its services into four main categories: Compute, Databases, Networking, and Storage & Content Delivery. Amazon has its own Hadoop framework called EMR, and it also offers Kinesis, which can process real-time data streams. AWS offers managed NoSQL and relational database services, many third-party integrations, and a strong encryption platform. It also supports Red Hat Enterprise Linux, which Azure doesn’t, and its GovCloud provides instant regulatory compliance for government agencies.

Microsoft Azure primarily targets PaaS customers, although its IaaS is expanding. If your company is interested in hybrid cloud services, Microsoft will soon offer Azure Stack for on-premises private clouds that integrate seamlessly with Azure’s public cloud. With Azure, developers worry only about maintaining their code. They don’t have to maintain their own VMs or worry about patches and security updates.

Rackspace is well known for its supports and its hybrid cloud offerings which is completely different than AWS or Azure offering. Rackspace offers Private Cloud for VMware, VCloud, Microsoft Cloud Platform and OpenStack(free and open-source cloud-computing platform written in Python). Dedicated hosting is Rackspace “Managed Hosting” solution which is a great feature of Rackspace offering.

Plateform Customer 2015 Revenue

AWS Netflix,Airbnb,Nasdaq,Pinterest, $7 billion
Azure Ford, NBC Digital $5 billion
RackSpace 3D Capacity, Acquity Group, Axios Systems, $2 billion
Behance, Blastro, Dominos Pizza, and Sage.

Speedtest.net download/upload tests

– Amazon EC2:
http://goo.gl/nnsxm
Download: 359.95 Mbps
Upload: 825.67 Mbps

– Azure:
http://goo.gl/k5z31
Download: 379.43 Mbps
Upload: 36.87 Mbps

– Rackspace Cloud:
http://goo.gl/tk6on
Download: 896.55 Mbps
Upload: 51.41 Mbps

Price:-
Azure instances are priced per minute
Amazon EC2 instances are priced per hour

Overall, AWS is more cheaper and robust than Azure in the market.

Posted in Cloud Hosting, Uncategorized | Comments Off on Best Public Cloud services – Amazon Web Services Vs Microsoft Azure Vs Rackspace

npm and Gulp installation steps for Laravel5 on WAMP environment.

Advantage of JavaScript task runner is

Minification and concatenation of JavaScript and CSS files

  • CSS Preprocessing
  • Image optimisation
  • Unit testing and linting

There is two different type of Javascript task runner:

  • Gulp – uses Node streams
  • Grunt -uses temp files

They both automate our tasks, they both use Node, and they both require you to create tasks and install plugins.

Grunt handles this using intermediary files which are disk I/O operations. Your SASS file is compiled and then written to a temporary file. The temporary file is used by the autoprefixer and then the final product is written to the destination file.

Gulp takes care of all this in-memory. Your source SASS file is compiled, the result is passed to the autoprefixer without being written to a file and the destination file is then written out.
Compared to in-memory operations, disk writes are slow which means that Gulp has a big speed advantage (for now).

Let’s start installing gulp on the WAMP environment.

Please download https://nodejs.org/ and run it. Make sure npm enable locally.

Open command prompt

C:\User\aoza> node -v
C:\User\aoza> npm -v
C:\User\aoza> cd /
C:\> cd wamp\www\laravel
C:\wamp\www\laravel> npm install express

Gulp installation

C:\wamp\www\laravel> npm install –save gulp-install //install gulp globally
C:\wamp\www\laravel> npm install – -save-dev gulp-install //Install gulp in your project devDependencies:
C:\wamp\www\laravel> npm install
C:\wamp\www\laravel> gulp
C:\wamp\www\laravel>gulp watch \\ updates only changes on css
C:\wamp\www\laravel> gulp –production // minify all css for production

Useful Links: https://travismaynard.com/writing/getting-started-with-gulp
http://laravel.com/docs/5.0/elixir

Posted in Uncategorized | Comments Off on npm and Gulp installation steps for Laravel5 on WAMP environment.

Installing laravel 5 on WAMP

Today, I’m super excited to learn about laravel for window. Laravel requires PHP 5.3.

Here is the step to install laravel for window.

  1. Download Composer from: www.getcomposer.org/Composer-Setup.exe
  2. Enable openssl from all php.ini files.
  3. Install Composer into the same directory php.exe is located.
  4. Click on WAMP icon->PHP->PHP Extensions and enable: php_openssl, php_curl, php_socket.
  5. Click on wamp icon->Apache->Apache Modules and enable ssl_module
  6. To check composer installed properly or not. please open command prompt and type ‘composer’.
  7. type ‘cd  /’ to get root c:\ drive
  8. Change into the directory where you extracted Laravel ex: C:\wamp\www
  9. type : ‘composer create-project laravel/laravel –prefer-dist’ to create new project
  10. Let it go to download laravel to this directory.it will download all dependencies.
  11. type ’cd laravel’
  12. type ‘php artisan serve’  for if you don’t have set up web server and want to run the application.
  13. Copy of the URL which you see in the command prompt example: http://localhost:8000.
  14. Finish.

 

Useful link for composer: http://www.tisuchi.com/how-to-install-composer-in-windows/

Install sublime text editor to view the code. Useful link :  http://www.sublimetext.com/

Laravel userful link :- http://laravel-recipes.com/recipes/282/running-phps-built-in-web-server
https://packagist.org/search/?q=phpsec

Posted in Uncategorized | 1 Comment

Moodle site Performance

Working with the content heavy LMS website is not easy task. Today, I come across the problem where site is getting slower when concurrent users are hitting system at the same time. Our client has set up LMS in their network which should be accessible on internal as well as external environment. There are a million ways to boost your LMS site performance. The three main areas that should work on first Hardware (Web server)/Network set up, Server side scripting Language and front end performance.

• Network Set up

You could ask list of questions to client about their network setup.

1. Reducing the number of unique hostname may increase response time.
2. How much network bandwidth in internal network?
3. How many workstations running in internal network and how much far from application server?
4. How many VM loaded on the Single Host?
5. Adding second NIC on application server
6. Memory overcommit on VM
7. Protocol acceleration for high latency
8. Out-of-band management can improve overall network performance through greater uptime
9. Adding caching/media server

• Web server side

1. Adding eaccelerator on Apache web server
Here is link for download eaccelerator :
http://www.sitebuddy.com/PHP/Accelerators/eAccelerator_windows_binaries_builds?page=2
http://www.sitebuddy.com/PHP/Accelerators/eAccelerator

PHP.ini setting (Make sure you have right version of eaccelerator based on PHP and thread/no- thread version)
extension=eaccelerator_ts.dll
eaccelerator.shm_size=”64″ ;
eaccelerator.cache_dir=”C:\eaccelerator”
eaccelerator.enable=”1″
eaccelerator.optimizer=”1″
eaccelerator.check_mtime=”1″
eaccelerator.filter=””
eaccelerator.shm_max=”0″
eaccelerator.shm_ttl=”0″
eaccelerator.shm_prune_period=”0″
eaccelerator.shm_only=”0″
eaccelerator.compress=”1″
eaccelerator.compress_level=”9″
eaccelerator.keys = “shm”
eaccelerator.sessions = “shm”
eaccelerator.content = “shm”
eaccelerator.admin.name=”admin”
eaccelerator.admin.password=”test”
eaccelerator.allowed_admin_path = “C:\test\eaccelerator\control.php”

2. Adding compression method on server.
You may need to add the mod_gzip compression on your server.It will help the PHP,HTML,CSS pages will be compressed before sent to the users’s browser.This reduces the file sizes of the transfer, which also reduce the connection time between your moodle server and client’s browser.So it should translate faster page loads!
Link for compression method:
http://www.neiland.net/blog/article/enable-gzip-compression-in-apache-httpd-with-moddeflate/
http://www.whatsmyip.org/http_compression/phpgzip/

• Front-end side

The front-end (i.e. your HTML, CSS, JavaScript, and images) is the most accessible part of your website.

http://sixrevisions.com/web-development/10-ways-to-improve-your-web-page-performance
http://sixrevisions.com/css/css_code_optimization_formatting_validation/
http://sixrevisions.com/web-development/site-speed-performance
http://www.cleancss.com
http://moz.com/blog/15-tips-to-speed-up-your-website

Posted in Moodle(LMS) | Comments Off on Moodle site Performance

Setting up HTTPS using SSL on window Apache environment

Follow below instructions to install the SSL on Apache.

  • Ensure port 443 is open on window
  • Click on the Windows Start Button
  • Click Windows Firewall
  • When the Firewall window opens look the the Advanced settings on the left hand side of the window
  • When the Advanced Firewall wondows opens, look again on the left hand side for Inbound Rules
  • When the Inbound/Outbound Rules window opens up, Enable rules which having port 443
  • Download latest Apache with ssl version (http://www.anindya.com/)
  • Copy all certificate files in apache conf folder.In my case my all certificates are “C:\Program Files (x86)\Apache Software Foundation\Apache2.2\conf”
  • Make sure certificates should have .key and .crt files.if you are thinking to create certificate in here is the link (http://blog.lifebloodnetworks.com/?p=677)
  • Find Apache conf file call httpd.conf .
  • Make a copy of httpd.conf file and edit the existing one.
  • Enable mod_ssl and mod_rewrite module in httpd.conf file
  • Add code “Listen port 443” in httpd.conf file
  • Add the SSL <Virtualhost> block in httpd.conf  file

    <VirtualHost 192.168.0.1:443>
    DocumentRoot /var/www/html2
    ServerName www.test.com
    SSLEngine on
    SSLCertificateFile  /path/to/your_domain_name.crt
    SSLCertificateKeyFile  /path/to/your_private.key
    SSLCertificateChainFile  /path/to/DigiCertCA.crt
    </VirtualHost>

  • Redirect All HTTP traffic to HTTPS.Add below line of code
  • Test your Apache config before restarting.
  • Restart Apache.

Note : ’SSLEngine On’ command wouldn’t work without adding SSLCertificateFile command.you can not test SSLEngine On command alone without adding certificate. Also, Make sure openssl.exe working correctly.

Posted in Apache, Categories | Leave a comment

SCORM[Sharable content object reference model] in LMS

Today i am very interested to write about SCORM [Sharable content object reference model].Lets know little background about SCORM.Why we are using SCORM courses instead of normal Flash courses?The US Department of Defense has specified that all of its content must be delivered via SCORM in Online training program so we must have to follow SCORM courses in LMS.We had done couple of courses in Flash based actionscript to provide physically to the clients but this is first time experience to create online courses with SCORM complaint.

How SCORM communicate with LMS?SCORM is basically made in javascript objects so LMS and courses are communicating using SCORM JavaScript.Its kind of request javascript variable to courses and get response to LMS as form of javascript variable.Its slower down the speed of courses itself using javascript SCORM.

Last week, we have built couple courses with SCORM complaint and uploaded in online Moodle based LMS.We have been facing speed issue in internet because our courses size is more than 30MB and also SCORM javascript is sometime giving us timeout error with only 10 tester at same time.We are going to built our system more robust for more than 200 users at same time to access the courses but we are facing problem with 10 tester then how we can achieve goal of 200 users?

Posted in Moodle(LMS) | 1 Comment

4DSOAP in PHP

I came accross problem with 4D SOAP request while i was working on web service.Normally webservice have only .wsdl file and PHP function can take care of rest of things but in my case, my client have webservice in 4D server another third party website who handle their database as well as web service.

4d server,a fourth-generation language with over 1000 high-level commands, a built-in HTTP server, application server, etc.It handle ANSI SQL relational and transcation database.After gone throught all documents,we concluded that 4D soap is much easier to integrate than 4D database because 4D database need PHP driver(PDO_4D) to handle PHP data objects.

Lets start with steps to handle 4D SOAP :-

1. In my case, my Client using firewall to block IPs address,they have suggested to open their firewall for our specific IP addresses because they didnt want to ping any person in their web service and get result.

2.Start to donwload SoapUI tool to test your webservice.Here is link to download http://sourceforge.net/projects/soapui/

3.4DSOAP has basically two methods SoapServicesTxt and SoapServicesBlob.These method has written from 4D server.Basically you have to pass all parameters and call function.There is no such rule you can only pass single parameter and get result.

4.Let start with PHP,I am using Nusoap class to call 4DSOAP server.Nusoap is having sample examples where you can see where is your request is going by nusoap parser.if any fault occure,its will tell you where soap fault occure during transftering request.

5. 4DSOAP request



       <?xml version="1.0" encoding="ISO-8859-1"?>
        <RequestedMethodWrapper>
        <RequestedMethodParams>
        <MbrxSoapLicenseNo>MBR3853850</MbrxSoapLicenseNo>
        <DataReturnFormat>XML</DataReturnFormat>
        <ServerDebugLog>Off</ServerDebugLog>
       <RequestedMethod>CompanyList3</RequestedMethod>
       <CompanyForOrgID>All</CompanyForOrgID>
       <MemberShipStatus>CurrentMembersOnly</MemberShipStatus>
       </RequestedMethodParams>
       </RequestedMethodWrapper>

5. My PHP code look like below

require_once('../lib/nusoap.php');
$client = new nusoap_client('http://173.299.294.241:8080/4DSOAP/');
$XMLstring='<?xml version="1.0" encoding="ISO-8859-1"?>
<RequestedMethodWrapper>
<RequestedMethodParams>
<MbrxSoapLicenseNo>MBR3853850</MbrxSoapLicenseNo>
<DataReturnFormat>XML</DataReturnFormat>
<ServerDebugLog>Off</ServerDebugLog>
<RequestedMethod>CompanyList3</RequestedMethod>
<CompanyForOrgID>All</CompanyForOrgID>
<MemberShipStatus>CurrentMembersOnly</MemberShipStatus>
</RequestedMethodParams>
</RequestedMethodWrapper>';
$result = $client->call('SoapServicesBlob', $XMLstring);
$responseXML = simplexml_load_string($result);
print_r($result);

Note: I am passing string as input in my 4DSOAP and return back in response as a string.Try to leave HTML entity Name as string don’t convert into Symbol of HTML entity..

Posted in Web Service | 2 Comments

Install Moodle(LMS) with MSSQL 2008

Last week,I have faced very critical problem to connect moodle1.9 with MSSQL 2008 on window server 2008 R2 64bit Operating System.Moodle community has lot of information about how to connect MySQL with moodle but buried information for MSSQL 2008.First of MSSQL is not open source so if anyone need to use for production server they must have to buy license version but i had install Express version of MSSQL for my development server.I never done  any work on MSSQL so kind of very new experience for me.

If you have Firewall on your network so please be careful for port number which you are going to enter in MSSQL installation.

Step 1:-MS SQL SERVER 2008 Express

1. Get MSSQL Server installed and running. (A free limited version, SQL Server Express Edition is available for testing.)

Make sure that you choose mixed authentication (Windows and local accounts) to keep things simpler later. You’ll be asked to define the “sa” account password (it’s the default System Administrator account which has full access to all databases by default).

2. Make sure MS SQL Server can accept incoming TCP/IP connections on port 1433 (the standard one).

You might need to explicitly allow this in your Windows firewall (see the Control Panel). You may also need to edit options in the :SQL Server Configuration Manager -> Network Configuration -> Protocols -> TCP/IP enabled

3. Install SQL Server Management Studio.Open the “SQL Server Management Studio” and create a new empty database. If you are using the “sa” account then you don’t need to do anything else here.

4. Configure these settings in your created (and still empty) database:

  • ANSI NULLS Enabled = true (ALTER DATABASE xxxx SET ANSI_NULLS ON)
  • Quoted Identifiers Enabled = true (ALTER DATABASE xxxx SET QUOTED_IDENTIFIER ON)

5. Get PHP installed with a web server.

6. Choose one of the following specific sections for your server to install the mssql extension alternative installed and running properly on your PHP box.

7. Set the following settings in your php.ini file

  • mssql.textlimit = 20971520
  • mssql.textsize = 20971520

Also, don’t forget to set one of the following alternatives, in order to get all the data properly “slashed”:

  • magic_quotes_gpc = Off or
  • magic_quotes_gpc = On and magic_quotes_sybase = On

8. With all this properly configured, you can continue with a standard Moodle installation.

Step 2:-Using FreeTDS to connect Moodle with MSSQL 2008

Moodle not easily allow to connect with MSSQL 2008.we need to install FreeTDS drive to connect with moodle.

  1. Download the appropriate copy of php_dblib.dll from the list below, and save it into your /PHP/ext directory.
  2. 2. You can download the required DLL(msvcr71.dll) from Frank’s site, and save it into your /PHP root directory.
  3. 3. Edit your /PHP/php.ini file and add this line:
extension=php_dblib.dll
     Make sure that any lines referring to the php_mssql.dll extension are DISABLED (commented out).
  1. When the PHP engine loads the FreeTDS extension it needs to be passed certain information in order to be able to connect to your Moodle database. To retrieve this information FreeTDS looks for a file called freetds.conf in the root folder of the server that PHP installed on (e.g. C:\).

freetds.conf should have the following structure:

[global]
  host = xxx.xxx.xxx.xxx (host name or ip of the MSSQL server)
  port = 1433
  client charset = UTF-8
  tds version = 8.0
  text size = 20971520

If you want to connect to a particular instance of MSSQL you should specify the instance name:

  [global]
   host = xxx.xxx.xxx.xxx (host name or ip of the MSSQL server)
   instance = xxx (instance name, e.g. INST2)
   port = 1433
   client charset = UTF-8
   tds version = 8.0
   text size = 20971520
Posted in Moodle(LMS) | 25 Comments