Posted by antonio lorusso on the August 14th, 2009
If you have recently upgraded to php 5.3 and you have done it using sudo port install php5 +apache2+macosx+mysqlnd+pear you should have noticed that you cannot use mysql anymore because of an error that, I’m sure, is driving you crazy PHP Warning: mysqli::mysqli(): [2002] No such file or directory (trying to connect via unix:///tmp/mysql.sock) in /Users/antonio/Sites/db.php on line 25
PHP Warning: mysqli::mysqli(): (HY000/2002): No such file or directory in /Users/antonio/Sites/db.php on line 25 The problem comes from php and unfortunately is only fixable changing the location of the mysql.sock from the usual macports directory /opt/local/var/run/mysql5/mysqld.sock to /tmp/mysql.sock editing the file /opt/local/etc/my.cnf
You have reverted an svn merge and you have a lot of files not tracked (with exclamation mark, basically)? Clean it up: svn status | awk '$1 == "?" {print $2}' | xargs -t -i rm -r {} Again, knowing awk and xargs turn helpful!
I was searching for a bash command to move files and directories from a folder to another with modified in a specific date for ages on google until I gave up and decided to write it myself: ls -l | awk '$6 == "2009-06-04" { print $8 }' | xargs -t -i mv {} /destination/folder
To understand what this line does, you need to know a bit about awk and xargs (try “man xargs” in your shell)
Explaination:
ls -l : directory listing awk ‘$6 == “2009-06-04″ { print $8 } : take the files and dir with date 2009-06-04 and print the list xargs -t -i mv {} /destination/folder : execute the mv command. {} is the result from the previous command.
I would like to explain you more, but I’m quite lazy and I leave you with google to undestand better the commands I’ve used.
Wow, I just noticed that my last post was 50 days old… I must have been busy, haven’t I? So, what am I doing? The first part time website in Ruby on Rails is going to be published and I was working on that almost every evening and weekend with Antonello. I should have written something about Rails and Ruby in here but … there is already a lot of material around the web.
Maybe I’ll post something on GIT that is a bit more obscure
We tried to setup a rails application in a server subfolder in a way that could have been accessible through an URL like http://servername/rails, so we followed the configuration manual for mod_rails.We found that, to make rails works in a subfolder, should have used the Apache parameter RailsBaseURI.
With a great surprise, that didn’t worked so we started trying all possible apache configuration combinations to avoid that 404 error that was becoming a nightmare.
After few hours we started doubting about our Apache knowledge and even about our capacity of reading and following a couple of stupid instructions on a website!
We gave up and we started googling around when… the solution came out from dozens of blogs, forums and newsletters:
MOD_RAILS IS NOT COMPATIBLE WITH RAILS 2.2.2 AND ITS NEW ROUTING SYSTEM
“HOLY CRAP” was our esclamation and I will not mention here all the italian’s bad words that suddenly came out from our mounth!
So, here the solution: put this line here config.action_controller.relative_url_root = "/guestbook"
in your environment.rb
Now restart apache and enjoy!
ps. why hadn’t we changed mod_rails with mongrel or anything different? I don’t know!!!!