When use cookie based authentication with phpymyadmin, mcrypt is missing on CentOS 6.2 by default.
Problem can be solved by installing EPEL repository.
For CentOS 6.2 x86_64, below is the steps to install mcrypt:
rpm -ivh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-6.noarch.rpm
yum update
yum install php-mcrypt
strtotime is useful. It can handle "+1 month" to a given time. It can cause problem if you do not think well before using.
Background knowledge:
In PHP, there are some time related functions: mktime, date, strtotime. While using integer as their parameter, the integer me
As we know, there is a function in PHP called fputcsv that can transfer array into CSV line.
However, if you make a CSV file only with these CSV lines, containing UTF8 characters, the generated CSV file will became a chaos in Excel.
Solution example:
$fp = fopen("php://temp", 'r+');
fprintf($fp, c
As I learned the existence of __halt_compiler, I tried to compact huge data into rarely used PHP file.
And I use the file in this way:
if (...statement of init matched...) {
require('init.dat'); // It is *.dat since it contains binary data for __halt_complier
}
However, because require or in
Now, 19 Apr 2011, CentOS still only brings PHP 5.1 with it, while PHP 5.3 is already there.
Today I want to use the filter extension which exists from PHP 5.2
To filter IP, there is lots of regular expressions (although they may not be tidy). But with the requirement of "filter private or reserved IP"
When the creation of database is included in the commonly running code, sometimes this part of code can be very huge. Also these will not be executed when the program found the database exists already, this will still waste some time when this part is parsing. These database creation code can be see
The idea begins when I see hash index is only for MEMORY/HEAP/NDB, and PHP array is a simple hash table.
Sometimes, we use MYSQL to store enumerable values. However, it is not that easy to change available values for these fields. Instead, we create another table to store those availables values, ass
Using AddThis to make things sharable will be easy. However, when it is with Facebook, there is a bug. The reason might be from upgrading of Facebook. Anyway, this bug escape the web address twice and will make the shared hyperlink not accessible. (When this article is written, the bug still ex
I didn't find obvious function that can return the results in stderr. So shell_exec is a general solution.
It's not some special function, but just something standard in shell. The answer is "2>&1". It means redirect message in stderr into stdout.
For example:
shell_exec("dir")
will return the
In Windows, while testing PHP program, have you ever seen "Apache Stopped Working"?
This is the first time when me saw it. I've been familiar with "notice", "warning", and "fatal error" given by PHP. "Fatal error". Is it serious enough? But comparing to "Apache Stopped Working"...
By debuggi
This is a result of several hours' hard-wording, so please keep my name there if possible when you are using it.
Test case:
echo htmlEscape(closeHtmlTags("<a>a")).'<br />'; // should be closed.
echo htmlEscape(closeHtmlTags("<_a>a")).'<br />'; // _a is not a valid ht
Attachment means files related to a text.
The purpose to store it in database, is to use foreign key to connect the text and attachment. So when the text is deleted, the attachment will be deleted automatically.
Since foreign key will be used, the table for text and table for attachment must both use
Colorbox is a jquery plugin. It can be found at http://colorpowered.com/colorbox/.
For a gallery, if the images are transfered through PHP, the path of the image would be like image.php?id=5
If the colorbox is loaded using a easy way like
$(document).ready(function(){
$("a[rel='group
Install cURL for php on Ubuntu:
sudo apt-get install curl php5-curl php5-xmlrpc
sudo /etc/init.d/apache2 restart
Install cURL for php on CentOS:
yum install curl curl-devel php-xmlrpc
sudo /etc/init.d/httpd restart
At some certain time, we may need to transfer data from MYSQL to MSSQL.
Tools is one choice.
If the above choice is difficult or not available, here are some steps to do that using SQL scripts:
Changing in scripts:
1. Export the old database as scripts for MYSQL.
2. Change "autoincrement" as "identity(1,
- 2013
- 2012
- 2011
- 2010
