I made the mistake of setting up Coldfusion 8 on a linux system (centOS) with the user set as 'nobody'. This proved to be a big mistake when it came to using tags like cffile to write to the filesystem. I had a hunt around for some info on how to do this with Adobe suggesting a reinstall of coldfusion
To change the user running coldfusion to the same as the owner of the web directory I completed the following steps.
1. vi /etc/init.d/coldfusion_8 then change the runtime user to the same as the user of your web folder
2. vi /etc/init.d/cfsearch8 then change the runtime user to the same as the user of your web folder
3. vi /opt/coldfusion8/bin/coldfusion then change the runtime user to the same as the user of your web folder
4. chown -R /opt/coldfusion8 name_of_new_runtimeuser
This allowed me to then use cffile to copy files to my server, however I was still running into a minor problem with the image functions of Coldfusion. Thanks to Ben Nadal who has a note on installing a hot fix to solve this problem.
Showing posts with label Coldfusion. Show all posts
Showing posts with label Coldfusion. Show all posts
Wednesday, April 8, 2009
Wednesday, April 16, 2008
Adding a Column to JSON using Coldfusion8
I use Spry to output a lot of queries that I use in my projects.
So I call my coldfusion function from Spry
There are a couple of things to note here, first of I am using Coldfusion 8's new returnFormat=json to return the query that resides in my function, as well as this I am also using queryFormat=column. Finally I have added on a date string to prevent browsers such as IE6 from caching the request.
So based on the above I can return my query as JSON, however I found that any dates were being returned in a fairly ugly way eg. March 21, 2008 00:00:00. I wanted to remove the dates and on consulting with a couple of people I came to the conclusion that doing this in Javascript would not be the best solution so I added the following after the query in my function.
This created an additional column in the JSON that was returned, and I could now display the date as I wanted to.
So I call my coldfusion function from Spry
var ts = new Date();
var spry_ContactList = new
Spry.Data.JSONDataSet("module_contacts.cfc?method=qry_ContactsList &returnFormat=json& queryFormat=column&TS=" + ts.toString(),{path:"DATA", pathIsObjectOfArrays:true});
There are a couple of things to note here, first of I am using Coldfusion 8's new returnFormat=json to return the query that resides in my function, as well as this I am also using queryFormat=column. Finally I have added on a date string to prevent browsers such as IE6 from caching the request.
So based on the above I can return my query as JSON, however I found that any dates were being returned in a fairly ugly way eg. March 21, 2008 00:00:00. I wanted to remove the dates and on consulting with a couple of people I came to the conclusion that doing this in Javascript would not be the best solution so I added the following after the query in my function.
<cfset tempArr = arrayNew(1) />
<cfloop query="qry_ContactsList">
<cfset arrayAppend(tempArr, "#DateFormat(qry_ContactsList.visitdate,'dd-mm-yyyy')#")/>
</cfloop>
<cfset qry_ContactsList.addColumn("PRETTYDATE", tempArr) />
This created an additional column in the JSON that was returned, and I could now display the date as I wanted to.
Saturday, October 6, 2007
Create a Virtual Server with Apache, VMWare and Blue Dragon
This is a brief guide to creating a VMWare Server that runs Centos Linux, PHP, MySQL, BlueDragon on Apache. It also briefly shows how you can run this so that the files being served in apache are running from a windows machine, which makes it perfect for a testing environment.
To begin
Download Centos5 from ThoughtPolice (www.thoughtpolice.co.uk) and unzip the VMWare image file
Load the file in VMWare Player
Once loaded log in username:root password:thoughtpolice
enter 'yum install apache2' (installs apache)
enter 'yum install mysql-server' (installs mysql server)
enter 'yum install php-mysql' (installs the plug ins for php and mysql'
enter 'system-config-securitylevel' (open port for apache www)
Create and share a windows directory called www and create a user on the windows machine called 'linux' with a password of 'linux'
On the virtual server enter 'mkdir /mnt/www' (creates a directory which you will mount the windows share on)
Then enter 'vi /etc/fstab' and add the line at the bottom of the file by pressing '*' then 'a' and adding //192.168.79.1/www /mnt/www rw,user=linux,password=linux 0 0 (the ip address at the front of this line is the ipaddress of the windows computer)
after this enter 'mount /mnt/www' this should mount successfully, if not you may want to check any firewall settings on the windows machine to make sure it will allow access from the ip address of the vmware server. You can check the ip address on a linux computer by entering (ifconfig)
Download the BlueDragon Script from www.newatlanta.com
Copy in the BlueDragon script to install into the windows shared directory you created
browse to the directory you created earlier on the linux machine 'cd /mnt/www' then copy the Blue Dragon script onto the Linux Machine 'cp bluedragonscript /home' make sure the blue dragon script has execute rights 'chmod +x bluedragonscriptname'
Browse to the home directory 'cd /home' and run the script 'sh bluedragonscript'
Accept all the defaults and make sure you select Apache as the option of webserver
Automatic Startup of BlueDragon 'ln -s /etc/rc.d/init.d/BlueDragon_Server /etc/rc.d/rc3.d/K95bluedragon' and 'ln -s /etc/rc.d/init.d/BlueDragon_Server /etc/rc.d/rc3.d/S95bluedragon'
Create a directory for apache conf files 'mkdir /mnt/www/conf' this is where we will hold .conf files for virtual hosting
Give apache access to your folder 'chgrp -R apache /mnt/www'
Start mysql /etc/init.d/mysqld restart
Set a password for mysql '/usr/bin/mysqladmin -u root password 'password'
Make sure mysql starts on bootup 'chkconfig mysqld on'
Make sure apache starts on bootup 'chkconfig httpd on'
Make sure you download the mysql jar odbc connector file from the mysql website. This needs to be copied into the bluedragon lib directory (/usr/local/NewAtlanata/BlueDragon_Server_70/lib) (make sure the correct permissions exist for this file), you can download it into the windows directory and copy it across from the virtual server.
Download phpMyAdmin from http://www.phpmyadmin.net/home_page/downloads.php copy it across into the directory /var/www/html on the virtual server. Then rename the folder to phpMyAdmin.
Should then be able to browse to this at http://ipaddressofvmaware/phpMyAdmin
The username should be root and the password as password as we set above.
To begin
Download Centos5 from ThoughtPolice (www.thoughtpolice.co.uk) and unzip the VMWare image file
Load the file in VMWare Player
Once loaded log in username:root password:thoughtpolice
enter 'yum install apache2' (installs apache)
enter 'yum install mysql-server' (installs mysql server)
enter 'yum install php-mysql' (installs the plug ins for php and mysql'
enter 'system-config-securitylevel' (open port for apache www)
Create and share a windows directory called www and create a user on the windows machine called 'linux' with a password of 'linux'
On the virtual server enter 'mkdir /mnt/www' (creates a directory which you will mount the windows share on)
Then enter 'vi /etc/fstab' and add the line at the bottom of the file by pressing '*' then 'a' and adding //192.168.79.1/www /mnt/www rw,user=linux,password=linux 0 0 (the ip address at the front of this line is the ipaddress of the windows computer)
after this enter 'mount /mnt/www' this should mount successfully, if not you may want to check any firewall settings on the windows machine to make sure it will allow access from the ip address of the vmware server. You can check the ip address on a linux computer by entering (ifconfig)
Download the BlueDragon Script from www.newatlanta.com
Copy in the BlueDragon script to install into the windows shared directory you created
browse to the directory you created earlier on the linux machine 'cd /mnt/www' then copy the Blue Dragon script onto the Linux Machine 'cp bluedragonscript /home' make sure the blue dragon script has execute rights 'chmod +x bluedragonscriptname'
Browse to the home directory 'cd /home' and run the script 'sh bluedragonscript'
Accept all the defaults and make sure you select Apache as the option of webserver
Automatic Startup of BlueDragon 'ln -s /etc/rc.d/init.d/BlueDragon_Server /etc/rc.d/rc3.d/K95bluedragon' and 'ln -s /etc/rc.d/init.d/BlueDragon_Server /etc/rc.d/rc3.d/S95bluedragon'
Create a directory for apache conf files 'mkdir /mnt/www/conf' this is where we will hold .conf files for virtual hosting
Give apache access to your folder 'chgrp -R apache /mnt/www'
Start mysql /etc/init.d/mysqld restart
Set a password for mysql '/usr/bin/mysqladmin -u root password 'password'
Make sure mysql starts on bootup 'chkconfig mysqld on'
Make sure apache starts on bootup 'chkconfig httpd on'
Make sure you download the mysql jar odbc connector file from the mysql website. This needs to be copied into the bluedragon lib directory (/usr/local/NewAtlanata/BlueDragon_Server_70/lib) (make sure the correct permissions exist for this file), you can download it into the windows directory and copy it across from the virtual server.
Download phpMyAdmin from http://www.phpmyadmin.net/home_page/downloads.php copy it across into the directory /var/www/html on the virtual server. Then rename the folder to phpMyAdmin.
Should then be able to browse to this at http://ipaddressofvmaware/phpMyAdmin
The username should be root and the password as password as we set above.
Subscribe to:
Posts (Atom)