Monday, May 20, 2013

How to encoding UTF-8 string to ASCII from Database

I have convert data from excel to mysql,
but when i printout to browser from database
seen string ugly..
i have resolve this issue, when i googling..


This simple way, just put the code like the bellow.
mb_convert_encoding($string_from_db, 'HTML-ENTITIES', 'UTF-8');

Wednesday, May 8, 2013

PHP Notice: A session had already been started - ignoring session_start()

I got this problem when redirect link location, but resolved this issue
this way:


Just put ob_start() function at beginning of the codes
< ?
ob_start();
header("location:home.php");
?>

Thursday, May 2, 2013

Turn off warnings and notice on PHP on Mac







To clear this issue, follow the step:
sudo cp -rf /etc/php.ini.default /etc/php.ini
sudo nano /etc/php.ini
then find and edit error_reporting
CTRL+W to find error_reporting module the change that code like the bellow line:
error_reporting = E_ALL & ~E_NOTICE
Restart your apache
sudo apachectl restart
that's all, reload your page.

Forbidden You don't have permission to access / on this server







I got this issue on Mac Lion OS X.
to fix this issue, just simple step.. here we go

Oper your terminal and type:
sudo nano /etc/apache2/extra/httpd-vhosts.conf 
add these line of codes:
< VirtualHost *:80>
   DocumentRoot "/Library/WebServer/Documents"
< /VirtualHost>
Restart your apache
sudo apachectl restart