mcrypt missing when using phpMyAdmin on Centos 6.7 “mcrypt” is an interface to the mcrypt library, which supports a wide variety of block algorithms such as DES, TripleDES, Blowfish (default), 3-WAY, SAFER-SK64, SAFER-SK128, TWOFISH, TEA, RC2 and GOST in CBC, OFB, CFB and ECB cipher modes. Additionally, it... |
Adding new cron job for automated processing on every 10 minutes on Centos 6.7 The software utility Cron is a time-based job scheduler in Unix-like computer operating systems. People who set up and maintain software environments use cron to schedule jobs (commands or shell scripts) to run periodically at fixed times, dates, or interv... |
How to optimize MySQL automatically in CentOS Linux I am using CentOS Linux for service purpose. Main reason to use CentOS is cheaper hosting for private purpose. Actually MySQL requires periodical optimization process in my experiences, and I use /etc/cron.hourly usually for those kind of bath processing.&... |
How to mount windows shared folder on Centos 6.8 - mount error 12 = Cannot allocate memory to the mount.cifs(8) In order to mount windows shared folder on CentOS, you need to install some packages like belowAnd the easiest way can mount the folder you want will be like belowIn case that you encounter error message like “mount error(12): Cannot allocate memory to the... |
Setup Apache+PHP+MySQL on Centos 6.7 If you installed Centos in minial installation mode, you should install Apache + PHP + MySQL manually.The followings are the procedure to install Apache + PHP + MySQL:Making apache and mysql to start automatically |
Set timezone and time on Centos 6.7 When using OAuth 1.0a, it requires timestamp for authentication. The followings are the example of shell commands which can set time information. Setup timezoneTo set the timezone of your system clock do the following:# rm -rf /etc/localtime# ln -s /u... |
Configuring IP Address on Centos 6.7 On Centos 6.7, you can check IP address configuration by ifconfig command as below:# ifconfig The below is the example of files on "/etc/sysconfig/network-scripts"# cd /etc/sysconfig/network-scripts# cd ls -Faltotal 220drwxr-xr-x. 2 root root 4096 Oct... |
PHP Switch Example Here's php switch example// switch example using integers$option=4;switch ($option) { case 1: echo "a good monkey sees no evil"; break; case 2: ech... |
How to send email in PHP ? Send an email from PHP - one line example. |
How to pass variables via url Pass variables to a page using the question mark, for example mypage.php?value=hello.Access these variables with the _GET command. |
How to declare array in PHP like C/C++ simple php array declaration: 'Do', 'Re', 'Me');//print out arrayprint_r($notes);?> |
PHP date and time formatting The Smarty date_format function returns a formatted string showing date, time and/or seconds.index.php:assign('yesterday', strtotime('-1 day'));$smarty->display('index.tpl');?>index.tpl:{$smarty.now|date_format}{$smarty.n... |
How to redirect browser in PHP ? Using the php header function, a browser can be redirected to another page. |
How to get current filename as variable ? Sometimes you need just the filename of the current script, without the path. This snippet does just that using the SCRIPT_NAME and explode function. $currentFile = $_SERVER["SCRIPT_NAME"]; $parts = Explode('/', $currentFile);&n... |
email validation, simple Validate an email address - returns TRUE or FALSE. Checks format only, does not use any networking functions to verify the account actually exists. |
for loop - simple for loop - basic control structure. This example loops until the variable hits 10 and then breaks out. 10) { break; } echo $i;}?>sample output :12345678910 |
form action - detect form post There are several ways to process a php form. This example looks for the existance (regardless of value) of the Submit _POST variable.//check if the submit variable existsif ($_POST['Submit']) { echo " |
How to make random number ? Generate a random number using mt_rand. From the php documentation- "If called without the optional min, max arguments mt_rand() returns a pseudo-random value between 0 and RAND_MAX. If you want a random number between 5 and 15 (inclusive), for example, us... |
How to check if a file exists ? To determine whether a file exists on the server, PHP has a simple function: file_exists. |
How to include a file with error reporting ? Sometimes you want to be able to give some feedback if a PHP include has failed. Here is a version using the fopen command, which can search the include path. |
PHP if...else... example Followings are the basic example of an if then else control structure. |
PHP form handling example in single page This example shows a very simple form together with the form handling process on a single page.//check if the submit variable existsif ($_POST['Submit']) { $mytext=$_POST['mytext']; echo " |
How to get reffering URL ? Grabs the referring URL - get the HTTP_REFERER and save it to a variable.code snippet:$ref = getenv("HTTP_REFERER");echo $ref;?> |
How to convert formatted date time string to datetime? Whatever the formatted string is, strtotime() function convert the formatted date time string to datetime.Following example shows the simple reference can convert date time string whatever the formatted input is...function foo($formatted_time){ retur... |
How to remove or set time limit that defined as max_execution_time in php.ini PHP provides the alternate function which can control time limit that defined in php.ini. Following is the alternate function can control time limit.void set_time_limit (int seconds);Set the number of seconds a script is allowed to run. If this is reached,... |
Adding and Subtracting Time The time () function generates a long string of numbers representing how many seconds have passed since January 1, 1970. It is possible to add and subtract time by adding and subtracting seconds. |
The three simplest regular expressions you will use in PHP The three most basic searches using regular expressions are searching for the strings start, the strings end, or for characters it contains. We can do these using the following symbols:^ indicates the string starts with the specified characters, so "^strcp... |
Send email Message With PHP This source code describes how to send email with php with headers |
Array_count_values This code prints array count values$array = array(1,"hello",1,"world","hello");print_r(array_count_values($array));?> |
Calculator with basic four functions See below as calculator with basic four functions. |