phpMyAdmin login/logout
If you are wondering where the logout link for phpMyAdmin in your installation is, most likely you have the automatic login configured (auth_type is “config”) in your configuration file, config.in.php.
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'admin_user';
$cfg['Servers'][$i]['password'] = 'password';
Just change the auth_type to “cookie” and you will be redirected to login page when refresh the phpMyAdmin session and you will see the logout link. 🙂
osTicket with GMail
We installed osTicket for some project. Man! it was not simple as I was hoping for.
Well, the basic installation was no pain, simple and easy; however, we had two issues with e-mail settings for gmail imap/pop utilization so the osTicket can send/receive ticket communication with customers.
Yes, that is right. osTicket let you receive e-mails from the customers for the reply to the ticket updates or to create a new ticket.
Gmail’s configuration instructions says:
imap.gmail.com Use SSL: Yes Port: 993 |
and
smtp.gmail.com (use authentication) Use Authentication: Yes Use STARTTLS: Yes (some clients call this SSL) Port: 465 or 587 |
No matter what I do, I could not register the imap server nor smtp server. It ended up connection refused error.
I tested those with “telnet” from the command line on the server and they were immediately refused for the connection. My hunch was they are blocked by the firewall of the shared hosting server that the client uses. Then I contacted the hosting company via chat session:
(03:46:17 PM) Me: is it possible that you guys are blocking certain ports?(04:01:09 PM) Support guy: My apologies, no, we do not block ports when connecting to Googles imap servers in anywya.(04:01:12 PM) Support guy: *anyway(04:05:05 PM) Me: $ telnet googlemail-imap.l.google.com 993Trying 74.125.45.16…telnet: connect to address 74.125.45.16: Connection refusedtelnet: Unable to connect to remote host: Connection refused(04:05:31 PM) Me: So are you saying I am refused by google?(04:05:49 PM) Support guy: Yes, it seems they are refusing the connection.(04:06:39 PM) Me: well, can you provide me a proof?
(03:46:17 PM) Me: is it possible that you guys are blocking certain ports?
(04:01:09 PM) Support guy: My apologies, no, we do not block ports when connecting to Googles imap servers in anywya.
(04:01:12 PM) Support guy: *anyway
(04:05:05 PM) Me: $ telnet googlemail-imap.l.google.com 993
Trying 74.125.45.16…
telnet: connect to address 74.125.45.16: Connection refused
telnet: Unable to connect to remote host: Connection refused
(04:05:31 PM) Me: So are you saying I am refused by google?
(04:05:49 PM) Support guy: Yes, it seems they are refusing the connection.
(04:06:39 PM) Me: well, can you provide me a proof?
(04:07:10 PM) Me: Since I do not have root access, I cannot perform certain operations
(04:07:36 PM) Me: the similar settings work from other hosts other than you.
(04:07:50 PM) Me: just FYI.
(04:08:29 PM) Support guy: One moment please.
(04:08:39 PM) Me: the ports in question are 465, 993 & 587
(04:09:29 PM) Support guy: I understand, one moment please.
(04:09:44 PM) Me: thx.
(04:09:59 PM) Support guy: Sure.
(04:17:50 PM) Support guy: One moment please.
(04:21:38 PM) Support guy: That should be working for port 995 now.
(04:22:34 PM) Me: confirmed. so was it blocked?
(04:23:20 PM) Support guy: It was, which it shouldn’t have been, I do apologize about htat.
(04:23:21 PM) Support guy: *that
(04:28:18 PM) Support guy: Is there anything else that I can assist you with today?
(04:28:38 PM) Me: is port 465 open also?
(04:29:31 PM) Support guy: One moment please.
(04:29:51 PM) Support guy: Yes it should be.
Yep, they were blocking certain ports. You have to trust your knowledge and gut feeling.
Enabling apache and PHP in OSX (Snow Leopard)
OS X Snow Leopard (10.6.x) comes with local apache server with lots of extensions/modules. You just need to configure (very easy) them in order to use it.
If apache is already configured (it should be), you can run it by:
sudo apachectl start
To check, if it is running, do this:
ps -aux|grep httpd
Then the typical output would be:
bgates 50737 0.0 0.0 2426844 328 s003 R+ 9:52AM 0:00.00 grep httpd
_www 50702 0.0 0.0 2451752 656 ?? S 9:43AM 0:00.00 /usr/sbin/httpd -D FOREGROUND
root 50701 0.0 0.2 2451752 9768 ?? Ss 9:43AM 0:00.51 /usr/sbin/httpd -D FOREGROUND
To enable php, you have to modify some configuration files:
find /etc/apache2/http.conf and uncomment it (remove the “#”)
#LoadModule php5_module libexec/apache2/libphp5.so
Then start/restart the apache instance by:
sudo apachectl start
or
sudo apachectl restart
PHP: str_word_counter does not count numerals
Realized that str_word_counter() does not count numerals (just numbers alone without alphabets) as a word.
The manual’s expression is:
mixed str_word_count ( string $string [, int $format = 0 [, string $charlist ]] )
If we supply “ab cd ef”, then the function returns 3, and if we supply “11 22 ab”, then it would be 1 since the function just ignores the numerals only value. The workaround (although it is not a bug or anything. It is a feature.) is to use the “$charlist”.
str_word_count ( string $string [, int $format = 0 , “0123456789” )
Then the numerals will be treated as letters.
T_PAAMAYIM_NEKUDOTAYIM?
What the heck is “T_PAAMAYIM_NEKUDOTAYIM” ???
When you are programming classes in PHP, you might encounter this error.
Parse error: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM in xxxxxx on line nn
Well, basically you screwed up some static scope reference somewhere. The origin of this error is something to do with the origin of PHP. According to wiki, the language was once worked on by two Israeli developers:
paam –> One
ayim –> Doubled
nekudot –> Dot
ayim –> Doubled
Seems like it means “double-colon” in Hebrew. (static class reference)
The easiest way to reproduce is:
<?php
$test::bogus();
?>
For many ways, the above reference method is wrong…