On Mac OS X if you encounter #2002 error when you install phpMyAdmin
Tips From:
http://harrylove.org/2008/11/03/mysql-error-2002-with-phpmyadmin-on-mac-os-x-105-leopard
Open the terminal
sudo mkdir /var/mysql
sudo ln -s /tmp/mysql.sock /var/mysql/mysql.sock
Reload the login page and login
Tuesday, March 03, 2009
phpMyAdmin #2002 mysql.sock
Posted by
SONARHYTHM Logic Pro School
at
9:25 AM
1 comments
Labels: mysql, PHP, programming
Thursday, January 08, 2009
php installation on leopard PEAR Smarty
I've upgraded to Leopard finally and I've ran into some problems upon running php PEAR and Smarty so i will list them and also their solutions.
1. Apache 2 user web site permission or access issue
This basically was the default configuration issue on leopard & apache 2.
Unlike tiger systems, you have to add username.conf or local.conf to gain access to user account on the web server.
It's is confusing that apple does this. but don't trust those words and ip addresses you see on the web sharing page on SystemPreference app.
and then add those Directory deny etc etc thing you do
after that for php you'll have to edit httpd.conf
just remove sharp from the line on php5 module.
2. PEAR
go-pear.php tutorial you see when you search for leopard pear installation works but bit wrong.
It tells you to include usr/share/pear even though the author is installing on some other directory...
well let PEAR installer handle all those directory (because it asks you if you want to change the include_path)
if you've installed PEAR on whatever directory that's the directory you need as the include path. You'll see capital PEAR folder somewhere and inside you'll see HTML, DB and things like that. that's the directory you need to include.
3 Smarty
download file from the website includes all documents. what you need to "cp" are inside the lib folder inside Smarty folder. don't follow direction as is.
4 PHP include_path
It's sometimes better to keep them as global include and when you want to do this would you install it on PEAR directory? you probably wouldn't want to do that. Then what you can do is to set multiple include_path directory.
private/etc/php.ini is the file you want to edit and look for include_path
when you want multiple include_path on mac system you cannot do : and another directory
instead do :: (two colons) between two directories.
for example,
usr/local/::usr/bin
all these you might need root level access to your system.
that's probably enough to remind myself of what to do next time I install so I won't have to waste couple hours struggling with it. hope this helps.
Posted by
SONARHYTHM Logic Pro School
at
12:20 AM
0
comments
Labels: PHP, programming, Web 2.0, WebDesign
Friday, June 29, 2007
PHP: Sessions
Sessions are not hard to understand either..
session is created per user/per site that use sessions.
Sessions:
- create session id and save it as a cookie PHPSESSID
- needs to be called at the very very top of the file by calling session_start();
session_start() will look for existing sessions and create new if there was none.
- sessions values can be added by storing into $_SESSION['key'] associative array.
and you can use it however you want it.
Posted by
SONARHYTHM Logic Pro School
at
10:56 AM
0
comments
Labels: PHP, programming
PHP: Include? or Require
it's always confusing which one is which but there is an interesting way to memorize this.
require file is something that requires and very strict.
include is a little less strict.
require will generate error when you can't open file but
include won't generate error. include only generate error when you call function inside that file doesn't exist for example.
makes logical sense to:
require when you have a function / library php file and you want to use that file.
include can be used for html or something that's only partially crucial.
require_once should be used for functions, etc to avoid multiple declaration.
Posted by
SONARHYTHM Logic Pro School
at
10:49 AM
0
comments
Labels: PHP, programming
PHP: Cookies
settting cookies were just so easy.. and i dont' even know why i couldn't use it.
maybe i was just refraining from it because they are not really secure...
setcookie($name, $value, $expire);
that's it....
expiration can be set by
time()+(60*60*24*7*30)
for a month
time() will print current time stamp, and you are adding number of seconds in a month.
deleting is done the same way except you set expiration to negative value or past..then the cookies will be deleted.
setcookie('test', 0, time() - 6); or whatever it indicates the past.
not sure on how long in the past so keep expiration value reasonable.
----------------
reading the cookie is like reading post values.
$_COOKIE['name'];
$value = $_COOKIE['name'];
echo $value;
just like that....too easy...
i was again got amazed but what a stubborn mind can do for us..so be open.
one more thing you can't for get is always check if the cookie isset();
Posted by
SONARHYTHM Logic Pro School
at
9:54 AM
0
comments
Labels: cookie, PHP, programming
