Posts

Showing posts with the label yii

Deploying Yii Application in Openshift Origin

Image
This post would describe how we deploy a Yii application into Openshift Origin. It should also work in Openshift Enterprise and Openshift online. Challenges PHP-based application that runs in a Gear must not write to the application directory, because it is not writable. Openshift provides a Data Directory for each gear, which we could use for the purpose of writing assets and application runtime log. For the case of load-balanced application, error messages written to application log is also stored in multiple gears, making troubleshooting more complex than it is. Solution Use deploy action hook in order to create directories in the data directory and symbolic links to the application. Change the deploy script to be executable, in Windows systems without TortoiseGit we need to do some git magic. Create this file as .openshift/action_hooks/deploy in the application source code. If your application is hosted using 'php' directory in the source code : If your a...

Compiling PDO_OCI in CentOS / RHEL

Background Similar to the previous post, my yii-framework based PHP application need to access to oracle database tables. Yii requires PDO_OCI PHP extension in order to access oracle database. I will describe steps that I took to compile PDO_OCI extension from php package source SRPMS.  Preparation In CentOS, we need to create /etc/yum.repos.d/source.repo because CentOS doesn't come with one : [base-SRPMS-6.5] name=CentOS-$releasever – Base SRPMS baseurl=http://vault.centos.org/6.5/os/Source gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 priority=1 enabled=1 [updates-SRPMS-6.5] name=CentOS-$releasever – Base SRPMS baseurl=http://vault.centos.org/6.5/updates/Source gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 priority=1 enabled=1 We also need yum-utils and rpm-build packages yum install yum-utils rpm-build Then, download the source package file with yumdownloader : [root@essdev ~]# yumdownloa...

How To Build PDO_OCI in Ubuntu 12.04

Building PDO_OCI extension in Ubuntu 12.04 is a little difficult. The reason : a. pdo extension are included in the php5 package b. PDO_OCI in pecl requires pdo extension source, not pdo extension binary c. pdo from pecl cannot compile under php 5.3 c. malformed tgz resulting from 'pecl download PDO_OCI' (well, as of today, 11-07-2014, it is) Why I need PDO_OCI? Well, I used Yii framework and need to access oracle database. Yesterday I tried this strategy to obtain pdo_oci extension : 1. downloaded instant client 10.2.0.4 basic and sdk from OTN (oracle tech network) 2. extract the instant client files, move them to  /opt/instantclient_10_2, create 3 symbolic links. 3. download php5 source package, and try to rebuild the php5 debs using debuild. This would ensure the php extensions were build. apt-get install dpkg-dev apt-get source php5 apt-get build-dep php5 apt-get install devscripts debuild -us -uc 4. after php5 deb created, change the debian/rules file to en...

Tips on Creating PDF using mPDF PHP library

In this post I will describe several ways to format HTML documents that will be converted into PDF file using mPDF PHP library. 1. Change Page Orientation Use CSS3 page and sheet-size attribute to change page orientation.  <style type="text/css">     .landscape {         page: a4landscape;     }     .portrait {         page: a4portrait;     }     @page a4portrait {         sheet-size: A4;     }     @page a4landscape {         sheet-size: A4-L;     } </style> <div class="landscape"> Portrait page </div> <div class="landscape"> Landscape page </div>  2. Change page margins To change page margins, you need to give additional parameter to mPDF's constructors. The...

Case of Session Identifier not Updated

Background Rational AppScan is an automated web testing tool that can be used to produce reports of web application vulnerabilities. So we usually use it to ensure our apps well protected before releasing them to the wild internet. The problem The problem with detection tools is that it sometimes raises a false alarm - such as when it declared that session identifier not updated : [1 of 2]  Session Identifier Not Updated Severity: High Test Type:  Application Vulnerable URL:  https://myinternalapp.com/application name/   Remediation Tasks: Do not accept externally created session identifiers Variant 1 of 1  [ID=26] The following may require user attention:  My normal reaction, because the app is a Yii framework-based PHP application, is that I should add Yii::()-app->session->regenerateID() call during login action. Imagine my surprise that upon retesting using Rational AppScan, it spits errors like these : Stopping scan due ...