Category: Coding

How to setup virtual hosts on apache2 @ Ubuntu 14.04

Great article, works perfectly!
https://www.digitalocean.com/community/tutorials/how-to-install-and-secure-phpmyadmin-on-ubuntu-12-04

Next, to setup LAMP use another article from the same site
https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu

And then to set up phpMyAdmin:
https://www.digitalocean.com/community/tutorials/how-to-install-and-secure-phpmyadmin-on-ubuntu-12-04


gmagick php extension on windows

gmagick is a PECL extension which branched off from imagemagick in 2002. Some developers prefer it as it is supposedly faster.

As of this writing, there is only one set of available dlls for gmagick on windows. This works only with PHP 5.3 If you are using PHP 5.4 (available on the new version of XAMP) it won’t work.

One has to use PHP5.3. To get it working I had to use WAMPserver, find the right php.ini (using phpinfo) and then add the extension to it.

Specifically in your php.ini:
extension=php_gmagick_ts.dll

Some key concepts to understand:
– The Visual C (VC) Version used for the extension DLL and your PHP installation must match. Common version mismatches are VC6 and VC9.
– PECL for Linux allows for automated download and building of PECL extensions, this feature is not available in windows, thus requiring one to specifically install Visual Studio and do the installs (do-able, but painful if you are not a VC developer)
– PHP windows builds are available at http://windows.php.net If you must use an extension (most likely to get someone else’s code working) and you can’t find the extension for the most recent version of PHP, best to downgrade PHP (use previous version dlls)

Adding borders to inline grids (with 960Grid)

To add borders to elements using 960 Grid, create divs under the elements 960Gid and apply borders to them.

960Grid applies margins, borders, padding to all the elements it creates. So intentions of overriding these may not work out.

The comment here explains it in other words: Also for anyone stumbling here, be careful about something like “border:1px solid;” on the divs, they will increase the width of the div by +2 px and it will cause the same symptom described. You run into the same problem with padding. The solution for that is to add divs inside your grid_x divs, and apply the border or padding to those inner divs. – Purrell Jan 24 ’11 at 2:55

PHP relative include require incude_once require_once

The concept of relative is always from the file being executed.

ralph l mayo explains with an example here

Note that the relative starting point is always from the file being executed. Ie., if you have:

/include.php
/myapp/index.php
/myapp/otherinclude.php

if index.php (the file the users requests) includes ‘../include.php’, include.php must include otherinclude as ‘otherinclude.php’ and not ‘myapp/otherinclude.php’

For this reason if you have includes spanning several directories or includes that are used in different contexts, it’s often easier to define a root path and include absolutely.

MySql troubleshooting System Error 5, System Error 1067

something went wrong with my MySQL instance. Looked up help online and tried starting mySQL through command line (with a hope to find out what was wrong)
Received: System Error 5 has occurred.

A little more searching revealed that I needed to run this in a Administrator Command window. To get that going do: start>run>cmd and then hit Ctrl+Shift+enter instead of the usual ‘enter’ only.

Next got 1067 when I tried net start

More googling revealed that mysqld –console would show the dump. Later realized that it is possible to get to the same error dump by visiting the data directory specified under my.ini config file. Anyways the Dump revealed:
C:Windowssystem32>mysqld –console
120623 13:02:55 [Note] Plugin ‘FEDERATED’ is disabled.
mysqld: Table ‘mysql.plugin’ doesn’t exist
120623 13:02:55 [ERROR] Can’t open the mysql.plugin table. Please run mysql_upgr
ade to create it.
120623 13:02:55 InnoDB: The InnoDB memory heap is disabled
120623 13:02:55 InnoDB: Mutexes and rw_locks use Windows interlocked functions
120623 13:02:55 InnoDB: Compressed tables use zlib 1.2.3
120623 13:02:55 InnoDB: Initializing buffer pool, size = 42.0M
120623 13:02:55 InnoDB: Completed initialization of buffer pool
120623 13:02:55 InnoDB: Operating system error number 3 in a file operation.
InnoDB: The error means the system cannot find the path specified.
InnoDB: If you are installing InnoDB, remember that you must create
InnoDB: directories yourself, InnoDB does not create them.
InnoDB: File name C:Program FilesMySQLMySQL Server 5.5datadata2ibdata1
InnoDB: File operation call: ‘create’.
InnoDB: Cannot continue operation.

The issue was because of InnoDB, something I did not plan to use. MyISAM Engine works out better for my purpose. So my next steps were.

Use the MySQLInstanceConfig at C:Program FilesMySQLMySQL Server 5.5bin to remove the instance.

Next modify the my.ini file to mark MyISAM as the default instead of InnoDB:
default-storage-engine=MyISAM

Next I attempted to re-install the instance using:
mysqld –install –defaults-file=”C:Program FilesMySQLMySQL Server 5.5my.ini

Same ISSUE!
I realized I had not uncommented the following line in my.ini:
skip-innodb

Repeated: uninstalling the instance(mysqld –remove ), recreating the instance and running net start

NOW it WORKED. Good bye InnoDB and the issue.

References that helped:
http://forums.mysql.com/read.php?10,837,5294#msg-5294
http://dev.mysql.com/doc/refman/5.0/en/windows-troubleshooting.html

Installing memcache/memcached on windows and linux for PHP

Some great articles on how to quickly get one setup without needing to compile from scratch.

Windows setup. Only nuance I faced was around Msvcp71.dll/Msvcr71.dll which can be overcome using this method. Also has quick code to test out the setup.

Linux (CentOS/RHEL)

Also good to refresh the concepts and inspirations behind memcache(from its originator) and understand the difference between the two PECL libs

Importing a large sql (mysqldump) file into mysql using phpmyadmin

The first things to check (or ask your host provider to check) are the values of upload_max_filesize, memory_limit and post_max_size in the php.ini configuration file. All of these three settings limit the maximum size of data that can be submitted and handled by PHP. One user also said that post_max_size and memory_limit need to be larger than upload_max_filesize.

Referenced Content