DreamHost Discussion Board http://discussion.dreamhost.com/postlist.pl?Board=forum_programming Threads in the "forum_programming" forum at the DreamHost Discussion Board! Sun, 27 Jul 2008 01:55:04 -0700 http://discussion.dreamhost.com/ en Customized cron path http://discussion.dreamhost.com/showflat.pl?Board=forum_programming&Number=109052&page=0&view=collapsed&sb=5&o=14&vc=1 Fri, 25 Jul 2008 17:02:00 -0700 bjhess forum_programming http://discussion.dreamhost.com/showflat.pl?Board=forum_programming&Number=109052&page=0&view=collapsed&sb=5&o=14&vc=1 Post Reply?

I have a custom gem source installed in ~/.gems. My ~/.bashrc looks like:

export GEM_HOME="$HOME/.gems"
export GEM_PATH="$GEM_HOME:/usr/lib/ruby/gems/1.8"
export PATH="$HOME/.gems/bin:$PATH"

My ~/.gemrc looks like:

gemhome: /home/bjhess/.gems
gempath:
- /home/bjhess/.gems
- /usr/lib/ruby/gems/1.8

So. I can run ruby jobs with special "requires" from my local gems fine via the command-line. However, when shoving the command into a recurring cron task, I get "no such file to load" errors:

/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in
`gem_original_require': no such file to load -- flickr_fu (LoadError)
from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in
`require'
from /home/.../.../scripts/slurp_flickr.rb:2

And if I try to call a command directly provided by a local gem (say, "staticmatic"), I get:

/bin/sh: line 1: staticmatic: command not found

What paths do I need to update to make these custom gems available from cron? I've scoured the 'net and the cron wiki for answers, but I can't fine 'em!

TIA,

Barry

]]> Post Reply?

I have a custom gem source installed in ~/.gems. My ~/.bashrc looks like:

export GEM_HOME="$HOME/.gems"
export GEM_PATH="$GEM_HOME:/usr/lib/ruby/gems/1.8"
export PATH="$HOME/.gems/bin:$PATH"

My ~/.gemrc looks like:

gemhome: /home/bjhess/.gems
gempath:
- /home/bjhess/.gems
- /usr/lib/ruby/gems/1.8

So. I can run ruby jobs with special "requires" from my local gems fine via the command-line. However, when shoving the command into a recurring cron task, I get "no such file to load" errors:

/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in
`gem_original_require': no such file to load -- flickr_fu (LoadError)
from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in
`require'
from /home/.../.../scripts/slurp_flickr.rb:2

And if I try to call a command directly provided by a local gem (say, "staticmatic"), I get:

/bin/sh: line 1: staticmatic: command not found

What paths do I need to update to make these custom gems available from cron? I've scoured the 'net and the cron wiki for answers, but I can't fine 'em!

TIA,

Barry

]]> How to connect to mysql with php http://discussion.dreamhost.com/showflat.pl?Board=forum_programming&Number=109039&page=0&view=collapsed&sb=5&o=14&vc=1 Fri, 25 Jul 2008 13:38:55 -0700 Brad99 forum_programming http://discussion.dreamhost.com/showflat.pl?Board=forum_programming&Number=109039&page=0&view=collapsed&sb=5&o=14&vc=1 Post Reply?

Hi, I am looking for advice as to what to use for the server name(I used localhost) parameter when trying to connect to a mysql database. I am using this but getting an error. Any ideas?

$connection=mysql_connect (localhost, $username, $password);
if (!$connection) {
die('Not connected : ' . mysql_error());

]]> Post Reply?

Hi, I am looking for advice as to what to use for the server name(I used localhost) parameter when trying to connect to a mysql database. I am using this but getting an error. Any ideas?

$connection=mysql_connect (localhost, $username, $password);
if (!$connection) {
die('Not connected : ' . mysql_error());

]]> re: htaccess help http://discussion.dreamhost.com/showflat.pl?Board=forum_programming&Number=109030&page=0&view=collapsed&sb=5&o=14&vc=1 Fri, 25 Jul 2008 09:30:19 -0700 dpix forum_programming http://discussion.dreamhost.com/showflat.pl?Board=forum_programming&Number=109030&page=0&view=collapsed&sb=5&o=14&vc=1 Post Reply?

I would be hugely appreciative if someone could help me solve a redirection issue I'm having. This is our current htaccess code:

RewriteEngine on
RewriteRule tag/(.+) http://www.domain.com/pub/mt-search.cgi?tag=$1&blog_id=34&Template=stare

The problem with this is that while http://www.domain.com/tag/example will redirect and search our CMS correctly, the redirection changes the URL.

Can someone please tell what we can do to this htaccess code so that the http://www.domain.com/tag/example will be 'sticky' and not display the CMS search URL.

Much thanks!

]]> Post Reply?

I would be hugely appreciative if someone could help me solve a redirection issue I'm having. This is our current htaccess code:

RewriteEngine on
RewriteRule tag/(.+) http://www.domain.com/pub/mt-search.cgi?tag=$1&blog_id=34&Template=stare

The problem with this is that while http://www.domain.com/tag/example will redirect and search our CMS correctly, the redirection changes the URL.

Can someone please tell what we can do to this htaccess code so that the http://www.domain.com/tag/example will be 'sticky' and not display the CMS search URL.

Much thanks!

]]> Upload via FTP or PHP http://discussion.dreamhost.com/showflat.pl?Board=forum_programming&Number=109024&page=0&view=collapsed&sb=5&o=14&vc=1 Thu, 24 Jul 2008 22:11:38 -0700 jlrray forum_programming http://discussion.dreamhost.com/showflat.pl?Board=forum_programming&Number=109024&page=0&view=collapsed&sb=5&o=14&vc=1 Post Reply?

I need a bunch of clients to be able to upload some PDF or DOC files. I was thinking of a PHP script to upload files but I heard there was a limitation of size. Some of the files being uploaded are near 10 MB large. If PHP wont work, do you guys know of a way to create individual ftp accounts and 1 account to manage all of them.

]]> Post Reply?

I need a bunch of clients to be able to upload some PDF or DOC files. I was thinking of a PHP script to upload files but I heard there was a limitation of size. Some of the files being uploaded are near 10 MB large. If PHP wont work, do you guys know of a way to create individual ftp accounts and 1 account to manage all of them.

]]> MySQL Selection Help http://discussion.dreamhost.com/showflat.pl?Board=forum_programming&Number=109017&page=0&view=collapsed&sb=5&o=14&vc=1 Thu, 24 Jul 2008 17:52:01 -0700 Joseph Witchard forum_programming http://discussion.dreamhost.com/showflat.pl?Board=forum_programming&Number=109017&page=0&view=collapsed&sb=5&o=14&vc=1 Post Reply?

When you're selecting a username and password from your database, how do you write your PHP script where it selects the correct user_id for that username and password? Or does the database do it for you when you tell it which username and password to retrieve in the WHERE clause (provided you write the query to retrieve the user_id as well, of course).

]]> Post Reply?

When you're selecting a username and password from your database, how do you write your PHP script where it selects the correct user_id for that username and password? Or does the database do it for you when you tell it which username and password to retrieve in the WHERE clause (provided you write the query to retrieve the user_id as well, of course).

]]> mySQL database duplication http://discussion.dreamhost.com/showflat.pl?Board=forum_programming&Number=108976&page=0&view=collapsed&sb=5&o=14&vc=1 Wed, 23 Jul 2008 16:28:21 -0700 orionsbelt forum_programming http://discussion.dreamhost.com/showflat.pl?Board=forum_programming&Number=108976&page=0&view=collapsed&sb=5&o=14&vc=1 Post Reply?

Is there a way to duplicate an existing database?

]]> Post Reply?

Is there a way to duplicate an existing database?

]]> PHP upload progress http://discussion.dreamhost.com/showflat.pl?Board=forum_programming&Number=108934&page=0&view=collapsed&sb=5&o=14&vc=1 Tue, 22 Jul 2008 11:49:25 -0700 n3ldan forum_programming http://discussion.dreamhost.com/showflat.pl?Board=forum_programming&Number=108934&page=0&view=collapsed&sb=5&o=14&vc=1 Post Reply?

Okay, I got custom php5, got apc for it. Everything works in that regards.

I tried Rasmus' upload progress script (http://progphp.com/progress.phps). It always returns false instead of returning progress.

$status = apc_fetch('upload_'.$_GET['progress_key']);

That's the relevant line. This code works on other servers, anybody know what's up?

]]> Post Reply?

Okay, I got custom php5, got apc for it. Everything works in that regards.

I tried Rasmus' upload progress script (http://progphp.com/progress.phps). It always returns false instead of returning progress.

$status = apc_fetch('upload_'.$_GET['progress_key']);

That's the relevant line. This code works on other servers, anybody know what's up?

]]> Bypassing Mod_rewrite http://discussion.dreamhost.com/showflat.pl?Board=forum_programming&Number=108901&page=0&view=collapsed&sb=5&o=14&vc=1 Mon, 21 Jul 2008 16:10:33 -0700 kblessing forum_programming http://discussion.dreamhost.com/showflat.pl?Board=forum_programming&Number=108901&page=0&view=collapsed&sb=5&o=14&vc=1 Post Reply?

Hello, I got this .htaccess setup on gwcmayhem.com

In reply to:


Options +FollowSymLinks

RewriteEngine On
RewriteBase /

RewriteCond %{HTTP_HOST} !^(www|webmail|ftp|mail|stats|mailboxes)\.gwcmayhem\.com [NC]
RewriteCond %{HTTP_HOST} ^([^\.]+)\.gwcmayhem\.com$ [NC]
RewriteRule ^.*$ /home/kblessing/gwcmayhem.com/view.php?member=%1 [L]

RewriteRule ^~(.*)/avatar.jpg /avatar.php?id=$1 [L]
RewriteRule ^~(.*)/(.*).jpg /userimg/$1/$2.jpg [L]



Basically it does what I want in regards of the subdomain passing it on to view.php

But I would like it if every other path (ie: if theres actually something behind the domain's / ) was treated as if it was on the main site.

For example if I do an image source of /~1/image.jpg I'd like to be able to do it just like that instead of http://www.gwcmayhem.com/~1.... having to spell out the entire domain of the main site just to load images, CSS, other scripts, javascript, etc.


-Karl Blessing ]]> Post Reply?

Hello, I got this .htaccess setup on gwcmayhem.com

In reply to:


Options +FollowSymLinks

RewriteEngine On
RewriteBase /

RewriteCond %{HTTP_HOST} !^(www|webmail|ftp|mail|stats|mailboxes)\.gwcmayhem\.com [NC]
RewriteCond %{HTTP_HOST} ^([^\.]+)\.gwcmayhem\.com$ [NC]
RewriteRule ^.*$ /home/kblessing/gwcmayhem.com/view.php?member=%1 [L]

RewriteRule ^~(.*)/avatar.jpg /avatar.php?id=$1 [L]
RewriteRule ^~(.*)/(.*).jpg /userimg/$1/$2.jpg [L]



Basically it does what I want in regards of the subdomain passing it on to view.php

But I would like it if every other path (ie: if theres actually something behind the domain's / ) was treated as if it was on the main site.

For example if I do an image source of /~1/image.jpg I'd like to be able to do it just like that instead of http://www.gwcmayhem.com/~1.... having to spell out the entire domain of the main site just to load images, CSS, other scripts, javascript, etc.


-Karl Blessing ]]> cURL http://discussion.dreamhost.com/showflat.pl?Board=forum_programming&Number=108826&page=0&view=collapsed&sb=5&o=14&vc=1 Sat, 19 Jul 2008 11:35:14 -0700 instanttron forum_programming http://discussion.dreamhost.com/showflat.pl?Board=forum_programming&Number=108826&page=0&view=collapsed&sb=5&o=14&vc=1 Post Reply?

I opened the browser with this url, http://77.666.555.44:8080/file/test.jsp
That is a sample server address
It works fine in the browser, I see the page.

But when I run it through cUrl it stalls and returns a blank page.
The error message I get from cUrl is “couldn’t connect to host”

Any reason why?
I am new to PHP
If anyone knows the answer please help
I have been stuck on this for weeks.
Any advice will be appreciated.

The PHP code:

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, “http://77.666.555.44:8080/file/test.jsp”);
curl_setopt($ch, CURLOPT_TIMEOUT, 20);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

$response = curl_exec($ch);

if (curl_errno($ch)) {
echo curl_error($ch);
} else {
echo $response;
curl_close($ch);
}



]]> Post Reply?

I opened the browser with this url, http://77.666.555.44:8080/file/test.jsp
That is a sample server address
It works fine in the browser, I see the page.

But when I run it through cUrl it stalls and returns a blank page.
The error message I get from cUrl is “couldn’t connect to host”

Any reason why?
I am new to PHP
If anyone knows the answer please help
I have been stuck on this for weeks.
Any advice will be appreciated.

The PHP code:

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, “http://77.666.555.44:8080/file/test.jsp”);
curl_setopt($ch, CURLOPT_TIMEOUT, 20);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

$response = curl_exec($ch);

if (curl_errno($ch)) {
echo curl_error($ch);
} else {
echo $response;
curl_close($ch);
}



]]> Change Loaded Configuration File http://discussion.dreamhost.com/showflat.pl?Board=forum_programming&Number=108818&page=0&view=collapsed&sb=5&o=14&vc=1 Fri, 18 Jul 2008 23:22:46 -0700 darthkimo forum_programming http://discussion.dreamhost.com/showflat.pl?Board=forum_programming&Number=108818&page=0&view=collapsed&sb=5&o=14&vc=1 Post Reply?

Could anyone help me?
Now, I having a trouble with my PHP Loaded Configuration File directory. I got two domains on my space and I want to make both of them PHP.ini 's registar_global = On. So I made a costume php.ini file.
Here is my php info:
http://urjourneys.com/phpinfom.php
http://www.thedesignwei.com/phpinfom.php

I want to make my "urjourneys.com"'s Loaded Configuration File change to the place I want.
Could anyone please tell me how to do it.

Thanks a lot,

Darthkimo

]]> Post Reply?

Could anyone help me?
Now, I having a trouble with my PHP Loaded Configuration File directory. I got two domains on my space and I want to make both of them PHP.ini 's registar_global = On. So I made a costume php.ini file.
Here is my php info:
http://urjourneys.com/phpinfom.php
http://www.thedesignwei.com/phpinfom.php

I want to make my "urjourneys.com"'s Loaded Configuration File change to the place I want.
Could anyone please tell me how to do it.

Thanks a lot,

Darthkimo

]]> mail() http://discussion.dreamhost.com/showflat.pl?Board=forum_programming&Number=108802&page=0&view=collapsed&sb=5&o=14&vc=1 Fri, 18 Jul 2008 00:48:04 -0700 Tarsuar forum_programming http://discussion.dreamhost.com/showflat.pl?Board=forum_programming&Number=108802&page=0&view=collapsed&sb=5&o=14&vc=1 Post Reply?

Hi!
I'm having problems with a simple php function.
On my dreamhost hosting can't send mails using this function. The most simple code returns 'true' (mail sent) but i dont get any mail...
mail('tarsuar@gmail.com','testingmail', 'lalalalala'); does not work on my hosting!!! WHY??
http://www.unlimitedps2games.com/p.php script got just that line in php.

I changed php version from 5 to 4, and from 4 to 5. Didn't work, just received 1 time an e-mail when changing version 5 to 4.
Really need this problem to be fixed!!

]]> Post Reply?

Hi!
I'm having problems with a simple php function.
On my dreamhost hosting can't send mails using this function. The most simple code returns 'true' (mail sent) but i dont get any mail...
mail('tarsuar@gmail.com','testingmail', 'lalalalala'); does not work on my hosting!!! WHY??
http://www.unlimitedps2games.com/p.php script got just that line in php.

I changed php version from 5 to 4, and from 4 to 5. Didn't work, just received 1 time an e-mail when changing version 5 to 4.
Really need this problem to be fixed!!

]]> MSSQL MYSQL http://discussion.dreamhost.com/showflat.pl?Board=forum_programming&Number=108785&page=0&view=collapsed&sb=5&o=14&vc=1 Thu, 17 Jul 2008 03:33:45 -0700 overblue forum_programming http://discussion.dreamhost.com/showflat.pl?Board=forum_programming&Number=108785&page=0&view=collapsed&sb=5&o=14&vc=1 Post Reply?

I know php and a little of python, and i need to make a script that retrieves data out of MSSQL external server and insert's it on a mysql server (if can't be done with php) or just get the data out of the external servers!
I already tried to install freetds (and it seems it's ok) but when i try to compile php gives a error saying that a dir where i install freetds is not the installation directory!

]]> Post Reply?

I know php and a little of python, and i need to make a script that retrieves data out of MSSQL external server and insert's it on a mysql server (if can't be done with php) or just get the data out of the external servers!
I already tried to install freetds (and it seems it's ok) but when i try to compile php gives a error saying that a dir where i install freetds is not the installation directory!

]]> Fatal error: session_start() http://discussion.dreamhost.com/showflat.pl?Board=forum_programming&Number=108743&page=0&view=collapsed&sb=5&o=14&vc=1 Tue, 15 Jul 2008 18:31:05 -0700 missdacia forum_programming http://discussion.dreamhost.com/showflat.pl?Board=forum_programming&Number=108743&page=0&view=collapsed&sb=5&o=14&vc=1 Post Reply?

Hello, I am new to PHP and running into a major issue with a user authentication class that I am using.

Error is:
Fatal error: session_start() [<a href='function.session-start'>function.session-start</a>]: Failed to initialize storage module: user (path: /tmp)

I have searched the forums and found a solution posted by urbanroute in 2006,
http://discussion.dreamhost.com/showthreaded.pl?Cat=0&Board=forum_programming&Number=53329&page=&view=&sb=&o=&vc=1#Post53329

I followed the steps by urbanroute and created a test page which worked fine, then i created the sesstmp dir and chmod 777, added this path to a .htaccess file, but still to no avail. In addition, the error still seems to be looking for /tmp.

I check the phpinfo() on my site after adding this line to .htacess:
php_value session.save_path /home/youraccount/yourwebsite.com/sesstmp (using my account info of course)
and the phpinfo() still shows /tmp.

So then I created /tmp in my domain directory as such /home/youraccount/yourwebsite.com/tmp and chmod to 777. Still no dice.

I added the .htaccess file to the following directory within my site: /home/youraccount/yourwebsite.com/, but should it be one above this? Meaning should it be here /home/youraccount/?

Also, I turned off Extra Web Security on the site to see if this was causing an issue.

I have my site set to use PHP 4.4x and my settings are as follows:

session.use_trans_sid - on
session.save_path - /tmp
session.save_handler - files

]]> Post Reply?

Hello, I am new to PHP and running into a major issue with a user authentication class that I am using.

Error is:
Fatal error: session_start() [<a href='function.session-start'>function.session-start</a>]: Failed to initialize storage module: user (path: /tmp)

I have searched the forums and found a solution posted by urbanroute in 2006,
http://discussion.dreamhost.com/showthreaded.pl?Cat=0&Board=forum_programming&Number=53329&page=&view=&sb=&o=&vc=1#Post53329

I followed the steps by urbanroute and created a test page which worked fine, then i created the sesstmp dir and chmod 777, added this path to a .htaccess file, but still to no avail. In addition, the error still seems to be looking for /tmp.

I check the phpinfo() on my site after adding this line to .htacess:
php_value session.save_path /home/youraccount/yourwebsite.com/sesstmp (using my account info of course)
and the phpinfo() still shows /tmp.

So then I created /tmp in my domain directory as such /home/youraccount/yourwebsite.com/tmp and chmod to 777. Still no dice.

I added the .htaccess file to the following directory within my site: /home/youraccount/yourwebsite.com/, but should it be one above this? Meaning should it be here /home/youraccount/?

Also, I turned off Extra Web Security on the site to see if this was causing an issue.

I have my site set to use PHP 4.4x and my settings are as follows:

session.use_trans_sid - on
session.save_path - /tmp
session.save_handler - files

]]> Camping http://discussion.dreamhost.com/showflat.pl?Board=forum_programming&Number=108736&page=0&view=collapsed&sb=5&o=14&vc=1 Tue, 15 Jul 2008 12:48:03 -0700 milkjam forum_programming http://discussion.dreamhost.com/showflat.pl?Board=forum_programming&Number=108736&page=0&view=collapsed&sb=5&o=14&vc=1 Post Reply?

Hi,

Does anybody know of any instruction on deploying a Camping app to Dreamhost, making use of Passenger?

]]> Post Reply?

Hi,

Does anybody know of any instruction on deploying a Camping app to Dreamhost, making use of Passenger?

]]> ffmpeg installed or not? http://discussion.dreamhost.com/showflat.pl?Board=forum_programming&Number=108720&page=0&view=collapsed&sb=5&o=14&vc=1 Tue, 15 Jul 2008 02:26:19 -0700 suman07 forum_programming http://discussion.dreamhost.com/showflat.pl?Board=forum_programming&Number=108720&page=0&view=collapsed&sb=5&o=14&vc=1 Post Reply?

I have my website hosted in dreamhost. How do I know if it supports ffmpeg or not? If it support how can I access it?

]]> Post Reply?

I have my website hosted in dreamhost. How do I know if it supports ffmpeg or not? If it support how can I access it?

]]> PDF and PHP http://discussion.dreamhost.com/showflat.pl?Board=forum_programming&Number=108714&page=0&view=collapsed&sb=5&o=14&vc=1 Mon, 14 Jul 2008 16:15:01 -0700 GFv forum_programming http://discussion.dreamhost.com/showflat.pl?Board=forum_programming&Number=108714&page=0&view=collapsed&sb=5&o=14&vc=1 Post Reply?

Hello.
Does anyone know if there are PHP classes that allows to open a PDF and save one or more pages from it as bitmap images?


]]> Post Reply?

Hello.
Does anyone know if there are PHP classes that allows to open a PDF and save one or more pages from it as bitmap images?


]]> Bash script help http://discussion.dreamhost.com/showflat.pl?Board=forum_programming&Number=108687&page=0&view=collapsed&sb=5&o=14&vc=1 Sun, 13 Jul 2008 19:08:02 -0700 makno forum_programming http://discussion.dreamhost.com/showflat.pl?Board=forum_programming&Number=108687&page=0&view=collapsed&sb=5&o=14&vc=1 Post Reply?

Hi guys, i'm having a problem with a bash script to run on a crontab:

i can get the script to login on a ftp and download all the stuff i need to backup and publish it on my website but i can't get the script to connect and delete the stuff that has been backed up. To explain what i was trying to do here is the lines i added:

#!/bin/bash
suffix=$(date +%y%m%d)
mkdir /home/user/domain.com/folder/$suffix
cd /home/user/domain.com/folder/$suffix
wget -nc ftp://user:pass@domain/folder/*.*

so until now it works fine: i run the script and all the files are backed up but i need to remove them from the souce so i added:

ftp
open domain
user
pass
cd /folder/
delete *.*

but the error is that when i execute the bash script i can see the shell at ftp: with no further action.

Also is it possible to add a line to automaticcaly create the .htaccess file in the folder that would just containt the line "DirectoryIndex some.htm" ?

Anyone can help?

]]> Post Reply?

Hi guys, i'm having a problem with a bash script to run on a crontab:

i can get the script to login on a ftp and download all the stuff i need to backup and publish it on my website but i can't get the script to connect and delete the stuff that has been backed up. To explain what i was trying to do here is the lines i added:

#!/bin/bash
suffix=$(date +%y%m%d)
mkdir /home/user/domain.com/folder/$suffix
cd /home/user/domain.com/folder/$suffix
wget -nc ftp://user:pass@domain/folder/*.*

so until now it works fine: i run the script and all the files are backed up but i need to remove them from the souce so i added:

ftp
open domain
user
pass
cd /folder/
delete *.*

but the error is that when i execute the bash script i can see the shell at ftp: with no further action.

Also is it possible to add a line to automaticcaly create the .htaccess file in the folder that would just containt the line "DirectoryIndex some.htm" ?

Anyone can help?

]]>