Linux

mysql on a nondefault socket

It is sometimes necessary to run two instances of mysql, like in my case. I need a mysql database in addition to the one Zimbra uses. One solution to this problem is to run the mysql database on a non default socket. This can be done by changing the following line in my.cnf my.cnf [client] […]

Read More
Web

Corrupt Content Objects in eZ Publish

On my eZDB I’ve found two different scenarios of corrupt objects, they must have become corrupt when not having transaction enabled, and eZp or the user breaks out of a content object creation, og content object edit: a content object exist only in table ezcontentobject, no referernces to object in any other ezcontentobject*-tables. SOLUTION: delete […]

Read More
Web

Check if a URL exists/is online

Function to check if a URL is online/exists. function is_valid_url($url){    $url = @parse_url($url);    if (!$url)    {        return false;    }    $url = array_map(‘trim’, $url);    $url[‘port’] = (!isset($url[‘port’])) ? 80 : (int)$url[‘port’];    $path = (isset($url[‘path’])) ? $url[‘path’] : ”;    if ($path == ”)    {   […]

Read More
Scripting

Compare Two Flat E-mail Lists with PHP

So here’s how I parsed to flat files with e-mail addresses (nothing special about it) approved_emails.txt has the following emails in it: email1@email.com email2@email.com check_emails.txt is composed of: email1@email.com email3@email.com email4@email.com My php file that I’m actually running from a command prompt is check_email_addresses.php < ? $approved_emails = file(“approved_emails.txt”); $check_emails = file(“check_emails.txt”); foreach ($check_emails as […]

Read More
Scripting

MySQL via PHP Cheat Sheet

Connect to MySQL and to the database // Connect to MySQL $connect = mysql_connect(“localhost”, “mysqluser”, “userpassword”) or die(mysql_error()); // Select the database mysql_select_db(“databasename”, $connect) or die(mysql_error()); PHP Manual Reference us2.php.net/manual/en/function.mysql-connect.php Close connection // Use the variable that was used to connect to MySQL mysql_close($connect) or die(mysql_error()); // PHP Manual Reference: us2.php.net/manual/en/function.mysql-close.php Create a database mysql_create_db(“dbname”) […]

Read More