Posts

Showing posts with the label PHP

Simple WebServer using PHP

Image
This is a simple example to design your own PHP web server used for application development or testing PHP script and should not be used on a public network . It works similar to the Apache web server with limited functionalities and not intended to be a full-featured web server. This tutorial demonstrates just to activate the built-in web server through a batch file. Instructions For designing a PHP web server, we simply need PHP software alone. The batch file(.bat) was created to activate the built-in web server, automatically open the default web browser with custom folder as root directory (www), and minimize the command line window while running the PHP script. Step 1: Download and extract compresed file (.zip) formatted PHP software according to your system platform. I have downloaded VC14 x64 Thread Safe (2017-Sep-26 23:04:10) for 64-bit Windows 10 OS. Step 2: Create a new folder www in the extracted folder. Also, create a new file index.html in the www folder ...

Frequency Plot of Protein Sequence using PHP and R

Image
A frequency plot is a graphical data analysis technique for summarizing the distributional information of a variable. The response variable is divided into equal sized intervals (or bins). The number of occurrences of the response variable is calculated for each bin. In this tutorial, the number of occurrences of each amino acids in the protein sequence (response variable) is calculated and sorted in ascending order. The frequency plot then consists of: Vertical Axis = Amino acids Horizontal Axis = Frequencies of the amino acids There are 4 types of frequency plots: Frequency plot (absolute counts); Relative frequency plot (convert counts to proportions); Cumulative frequency plot; Cumulative relative frequency plot. The frequency plot and the histogram have the same information except the frequency plot has lines connecting the frequency values, whereas the histogram has bars at the frequency values. Frequency plot using PHP and R In this tutorial, the programming langu...

Extracting Multiple FASTA Sequences using PHP

Image
This is a simple tutorial which explains how to safely extract multiple sequences from a FASTA file using PHP script. I have used four functions to perform different tasks: read_fas_file() - to check invalid file, fas_check() - to check FASTA file format, get_seq() - to retrieve sequence and sequence name pairs, and fas_get() - to extract and display multiple FASTA file formatted sequences. The full source code and multiple protein sequences in FASTA file format used in this tutorial is given below. Source Code function read_fas_file($x) { // Check for Empty File if (!file_exists($x)) { print "File Not Exist!!"; exit(); } else { $fh = fopen($x, 'r'); if (filesize($x) == 0) { print "File is Empty!!"; fclose($fh); exit(); } else { $f = fread($fh, filesize($x)); fclose($fh); return $f; } } } function fas_check($x) { // Check FASTA File Format $gt = substr($x, 0, 1); if ($gt != ">") { print "Not F...

How to upgrade phpMyAdmin in XAMPP to latest?

Image
Most of the windows users choose XAMMP to install Apache distribution containing MySQL, PHP, phpMyAdmin, and Perl. But, if you try to update any one of the softwares, you may face difficulties. Either you must have to install the latest version of XAMPP (or) you must update the software and configure the web server manually. In such case, we may either loss the data (or) it may remain nonfunctional. So it is safe to take backup of whole files, before trying to install manually. In this tutorial, I have tried to update the old phpMyAdmin in the XAMPP to phpMyAdmin 4.2.12 ( the latest stable release, as on Nov 29, 2014 ) and faced many technical problems. I searched through google for this issue, but I didn't got a proper solution. Finally, I referred the phpMyAdmin error message and documentations and solved the problem. It works fine now. The simple and easy steps which I followed is explained below: Download the latest version of the phpMyAdmin from the official site ht...

Converting XAMPP into XAMPPP

Image
This tutorial explains about a simple method to configure Apache, PHP, MySQL, Perl and Python in windows platform. In this tutorial, I have used the latest operating system (Windows 8.1 Enterprise Edition 64-bit) and latest softwares - XAMPP 1.8.3 and Python 3.3.0. Refer official site of XAMPP and Python for installation instructions. XAMPP is an easy to install Apache distribution containing MySQL, PHP and Perl. The XAMPP 1.8.3 contains of Apache, MySQL, PHP + PEAR, Perl, mod_php, mod_perl, mod_ssl, OpenSSL, phpMyAdmin, Webalizer, Mercury Mail Transport System for Win32 and NetWare Systems v3.32, Ming, FileZilla FTP Server, mcrypt, eAccelerator, SQLite, and WEB-DAV + mod_auth_mysql. The default configuration of Apache is perfectly linked with MySQL, PHP and Perl. Since Perl and Python run under common gateway interface (CGI), configuring Python CGI with XAMPP is very easy. To convert XAMPP into XAMPPP, we have to change the existing AddHandler Apache configuration command to AddHa...

Replacing form fields by text in PHP

Image
In PHP, the form field has replaced with the custom text after processing by either using an HTML file or hiding the form fields using the PHP script. This method can also be used for applying static header and footer on the web page. In the following example, I have used an HTML file and PHP script to add two numbers. The HTML file content has replaced during the execution. Before Execution After Execution Source Code: form.html <form method="post" action="<?php print $_SERVER['PHP_SELF']; ?>" > First Number: &nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="first"><br> Second Number: <input type="text" name="second"><br><br> <input type="reset" value="Reset"><input type="submit" value="Submit"> </form> addition.php <html> <head> <title>Adding two number...

Two methods to run PHP script

This article explains different methods to write PHP scripts. Basically PHP is a HTML, without using PHP script in it. A PHP script can be inserted between <?php and ?> tags. General contents can be simply displayed using HTML web page to reduce PHP server script runtime duration. HTML and PHP HTML: add.html <html> <head> <title>Addition of Two Numbers</title> </head> <body> <form action="add.php" method="post"> Enter the first number: <input type="text" name="a"><br/> Enter the second number: <input type="text" name="b"><br/> <input type="submit" name="submit" value="ADD"> </form> </body> </html> PHP: add.php <html> <head> <title>Addition of Two Numbers</title> </hea...