The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
how to forward mail in /var/mail/username to external mail unitipon SUN Solaris 2 05-27-2008 12:20 AM
send mail purtcular subject forward s_sheik Linux 1 01-17-2008 10:11 AM
forward root mail csaunders SUN Solaris 1 11-23-2004 04:35 PM
.forward file for mail redirection giannicello UNIX for Dummies Questions & Answers 3 01-12-2002 11:06 AM
E-mail forwarding BigBro UNIX for Dummies Questions & Answers 1 12-03-2000 11:40 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 01-28-2006
bitt3n bitt3n is offline
Registered User
  
 

Join Date: Jan 2006
Posts: 2
.forward and alias mail forwarding questions

I am trying to configure sendmail to forward email to a PHP script. I don't know UNIX and am having trouble figuring out how to forward the mail. I think this is just a bunch of basic questions, but I have had little luck getting help elsewhere on my specific questions and it's driving me nuts. You can see the instructions I am trying to follow here: http://www.devarticles.com/c/a/PHP/I...ail-and-PHP/1/

The instructions say I need to do 3 things:

1) forward email using either a ".forward" file or a modified "alias" file (the preferable method, if I have "root access")

I want to use the alias file, seeing as it's the preferred method. Supposedly the alias file should be found in my /etc directory, but using shell access to my site I see no such file in the /etc folder off the top directory. Am I looking in the wrong place? Do I have to create it? If I want to create/modify the alias file to forward mail sent to script@myurl.com to "|/our/script.php", what specific command do I use?

With regard to the .forward file, I've been wandering around among the directories trying to find my mail folder so I can put the .forward file in there, but I have no idea where it should go.

2) Now the instructions say "Since our script will function as a shell script, the first line should contain the path to the PHP CGI program. This is most likely located at /usr/bin/php of /usr/local/bin/php. This tells the operating system that this script must be parsed by PHP."

I'm sorry for asking such a stupid question, but what does the "of" in "/usr/bin/php of /usr/local/bin/php" mean? I see a file "php@" in the directory "/usr/local/bin/php" but I do not know what is meant by "/usr/bin/php of /usr/local/bin/php". Also, how do I tell that PHP is compiled as a CGI module?

3) Once I write and save the script, I must put it in the correct location, and make it executable with "chmod 755"

Googling chmod, my understanding is that to do this, I navigate to the directory my script is in, and type "chmod 755 script.php" Is that right?

Thanks for your help.
  #2 (permalink)  
Old 01-28-2006
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon
  
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,111
1. There are many versions of unix and many versions of sendmail. It is cast in concrete that sendmail is in use, but it is the most popular MTA. You need to figure out what version of unix you are using. "uname -a" should tell you that. The alias file could be almost anywhere. I doubt that it is directly in /etc. But /etc/mail might be a possibility. I have never seen sendmail running without an alias file in existence. Sendmail is required to support the postmaster alias and it can't without an alias file. But note that your doc says .forward is in your home directory. No version of sendmail will put it anywhere else. It is not unusual for .forward to not exist. So simply create it.

2(part 1). Gotta be a typo. Instead of "of", it should say "or".

2(part 2) and 3. I am not a PHP expert or a web expert. But there are decisions that were made when the web server was set up. You are assuming that CGI scripts are going to work. CGI can be turned off. If it is turned on, it will probably be required that CGI scripts be in some particular directory. You need to move your script to that directory. But yes, you have the chmod command right. Note that "CGI module" was not one of the two choices the author offered. I am not sure how to tell the difference between CGI binary and Apache module. But of all this involves reverse engineering installation decisions. You might consider posing some of these questions to the guy who configured your system. Or maybe some PHP/CGI expert will come along here with some wisdom. Good luck.
  #3 (permalink)  
Old 01-29-2006
bitt3n bitt3n is offline
Registered User
  
 

Join Date: Jan 2006
Posts: 2
OK unfortunately I am still having some issues

1) Someone suggested I find the aliases file with "find /etc -name aliases -print", but it returned no results. (I was in the top directory)

I then tried "find -name aliases -print" and got the following results:

dgodshalk:/$ find -name aliases -print
find: ./home/aschwartz/.ssh: Permission denied
find: ./.renv/etc/default: Permission denied
find: ./.renv/tmp: Permission denied
find: ./.renv/var/lib/mw: Permission denied
find: ./.renv/var/spool/cron: Permission denied
find: ./.renv/var/state/sasl2: Permission denied
./.renv/usr/lib/perl5/site_perl/5.6.1/i386-linux/Unicode/Map8/maps/aliases
find: ./.renv/usr/share/doc/sablotron-1.0: Permission denied
./.renv/usr/share/doc/bash-2.05/startup-files/apple/aliases
find: ./.renv/usr/share/ssl/CA: Permission denied
find: ./.renv/usr/share/fonts/cmpsfont: Permission denied
./.renv/usr/share/texmf/aliases
find: ./.renv/root: Permission denied

So there are three aliases files, and I don't know which one is the right one (if any). I assumed I was using Sendmail because in my hosting provider's FAQs they make reference to Sendmail. (I am hosted on modwest.com)

Anyway I will try with a .forward file. I understand (perhaps wrongly) that it should go in the folder named after a given user in the home directory. I want to create a new user for this, so that mail does not get forwarded for an existing user. I searched around for 'create new user' commands in UNIX on google and found adduser, but trying to use it returns:

bash: adduser: command not found

So next, I create an new email account using my hosting provider's CP, and create a folder in the home directory corresponding to this user account, and create a .forward file in this home directory using pico. Strangely, I cannot see the .forward file I created (because it begins with a period, perhaps?), but if I try to save it again I get an overwrite warning, so I know it is there. The .forward file I created contained an email address instead of a link to a script, so that I could confirm that it was working. It is not working, so obviously I am still completely misunderstanding some part of this process.

2) I found the full path to php using the command

ls -l /usr/bin/php

which returned

lrwxrwxrwx 1 root root 18 Feb 17 2005 usr/bin/php -> /usr/local/bin/php*

even this is confusing to me. what does "usr/bin/php -> /usr/local/bin/php*" mean? which one is the path? there is a file called php@ in the former directory (along with a billion other files), and there is a file php@ in the latter directory also (along with a smaller number of files, many of which look like various versions of php, including php-5.0.4, php-5.0.3 etc.).

I checked my version of UNIX as you suggested by using "uname -a", so for what it's worth, this returned:

Linux pintlar.modwest.com 2.4.20-mw13 #1 Fri Dec 5 16:27:24 MST 2003 i686 unknown

Thanks for your help so far. I will continue to hunt around for solutions to these problems, and look forward to any additional suggestions you might have that will help determine the right aliases file and get .forward to work. I have a feeling these things are not so complicated, but so far this has been somewhat confusing.
  #4 (permalink)  
Old 01-29-2006
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon
  
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,111
2. That is a symbolic link. So /usr/bin/php is just an alternate way to open /usr/local/bin/php. Two paths to the same file...sort of.

1. Those permission denied messages mean you are not root. You won't have the power to edit aliases should you find it. Nor can you run adduser. And yes, files that start with a dot are hidden to a limited degree.
ls -la
will let you see them.
Closed Thread

Bookmarks

Tags
linux commands

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 12:38 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0