LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 09-03-2014, 04:32 PM   #1
anon091
Senior Member
 
Registered: Jun 2009
Posts: 1,795

Rep: Reputation: 49
Migrating xampp website, but php form doesn't send email from new server


Hi everybody. I've been working on migrating a current dying server running a website in xampp to a new server in a modern version of xampp. I think i'm almost there, but I'm having a problem with a .php webpage that's a form that (when working) emails the form data to someone.

The form displays ok, but for some reason the email doesn't send when I hit the submit button. Comparing to the dying server that still works, I don't see anything in /var/log/maillog on the new server like I do on the dying one, so I'm guessing it's not trying to send.

I know sendmail is working, because i can manually send an email via the command line.

But does anyone have a clue where I should look as to why from here? and sorry, I know this is a real vague question.
 
Old 09-05-2014, 06:39 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by rjo98 View Post
I've been working on migrating a current dying server running a website in xampp to a new server in a modern version of xampp.
Well, sorry to say but that's where you've gone wrong in the first place. As I've been saying for years, as the XAMPP documentation (which now seems to be tucked away so you'll only find it when you're really looking for it) has been saying for years XAMPP is not intended for use in Production Environments: see Is XAMPP production ready? *XAMPP is a "convenience" suite of software solely for development use, and then only for those that can't be (bothered to) learn how to set up LAMP properly. With all due respect people who can't be (bothered to) set up Apache, MySQL and PHP properly shouldn't be let near any public-facing server in the first place.


Quote:
Originally Posted by rjo98 View Post
does anyone have a clue where I should look as to why from here?
Not where but who: if you're not a coder chances are you don't know safe coding standards. (Last time I looked your profile didn't read "PHP coder".) That said start by comparing the new environment (which I sure hope is on an isolated Staging machine and not in Production yet) with the old in terms of daemon configuration (including includes), users, file and directory access rights and phpinfo(). Note that there may be huge differences between deprecated and current PHP versions.
If that's not it craft a simple temporary mail form yourself that's been known to work and test with that.
If that's not it check if adding
Code:
<?php
 ini_set('display_errors', 'On');
 error_reporting(E_ALL);
to the "misbehaving" mail form helps.
If that's not it look into http://xdebug.org/.

*Note none of the above detracts from the fact you (or your client) choose to use XAMPP which you should not.
 
1 members found this post helpful.
Old 09-05-2014, 08:15 AM   #3
anon091
Senior Member
 
Registered: Jun 2009
Posts: 1,795

Original Poster
Rep: Reputation: 49
Thanks unSpawn. Yeah, definitely not a PHP coder, and no clue why they went with xampp to begin with (probably due to your too lazy to configure it properly), but they requested it in xampp again (I think because they think a .tgz backup of the entire thing is so easy).

And honestly, I've never really set up a web server before in general but i'm trying to learn. I did already create a php form I copied from a php tutorial to simply enter a few fields and send an email, but that didn't do anything either. Also, the existing form does work on the old server.

I'll try your couple suggestions and post back.
 
Old 09-05-2014, 08:34 AM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Hmmm. If you're "just a grunt" you could suggest they should not use XAMPP. On the other hand if you're hosting their web site you have a responsibility and you should tell them. After all then its your server that will be abused, IP address that will get a bad reputation or be blacklisted, your time that will be wasted mopping up...
 
1 members found this post helpful.
Old 09-05-2014, 08:55 AM   #5
anon091
Senior Member
 
Registered: Jun 2009
Posts: 1,795

Original Poster
Rep: Reputation: 49
I'd like to suggest to not use xampp, but with me not exactly knowing how to setup a web server in general, I'd feel kinda silly, know what I mean.

Really this site is just some html pages and a couple php forms that send emails out. and it's strictly an internal server/site.
 
Old 09-05-2014, 09:06 AM   #6
anon091
Senior Member
 
Registered: Jun 2009
Posts: 1,795

Original Poster
Rep: Reputation: 49
Added that bit of php code to the test form I had, don't see any errors on the webpage itself, it acted like it worked, but didn't get any email. I hate xampp haha.
 
Old 09-05-2014, 09:08 AM   #7
anon091
Senior Member
 
Registered: Jun 2009
Posts: 1,795

Original Poster
Rep: Reputation: 49
unSpawn, or anyone reading this, is there a good tutorial out there I can follow step by step to try to set this up in a "legit" way (not using xampp)? I'd love to give it a shot since xampp gets no love.
 
Old 09-05-2014, 10:34 AM   #8
anon091
Senior Member
 
Registered: Jun 2009
Posts: 1,795

Original Poster
Rep: Reputation: 49
OK, think I found what may be a good article to try to give this a go sans xampp.

https://www.digitalocean.com/communi...-php-on-fedora

Does this sound about right to you guys? Then i just need to figure out where to put the .htm and .php files from the current site onto the new server, and I might be in good shape since sendmail is already working?

I know, kinda going off topic here, but i think this is the right way.
 
Old 09-05-2014, 10:48 AM   #9
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
For one thing the database this site uses (if any, as it's plain HTML as you said) you can export and check for whatever is there. Then check php.ini, my.cnf and httpd.conf and includes and the vhost definition. Take another (virtual?!) machine, install a "base" install of CentOS 6.5 and configure it using https://www.centos.org/docs/ and http://wiki.centos.org/Documentation, http://wiki.centos.org/HowTos and http://wiki.centos.org/TipsAndTricks. Using the http://www.sans.org/score/checklists/linuxchecklist.pdf, https://people.redhat.com/sgrubb/fil...ning-rhel5.pdf and https://access.redhat.com/documentat...uide-en-US.pdf harden the OS. Install Apache, MySQL and PHP. Make backups of the original php.ini, my.cnf and httpd.conf and compare with the "old" ones. Leave default settings as much default as possible. With the httpd.apache.org/docs/, dev.mysql.com/doc/ and php.net/docs.php at hand edit in the changes you have verified this site requires. Rsync the docroot and test. Proceed by verifying using GNU/Tiger, https://benchmarks.cisecurity.org/downloads/ and https://www.owasp.org/index.php/Cate...op_Ten_Project. Top it off by running a remote OpenVAS scan, ensuring backup testing, auditing as well as regular software updates are in place.

Is it that easy?
Yes, it is! ;-p
 
1 members found this post helpful.
Old 09-05-2014, 10:53 AM   #10
anon091
Senior Member
 
Registered: Jun 2009
Posts: 1,795

Original Poster
Rep: Reputation: 49
I'm already loading up a base CentOS 6.5 in vbox, so at least I was on the right track before you posted :-)

Thanks for all those links! I'm going to give this a go. I'll post back if/when I run into any problems, or if I successfully do this on my own (fingers crossed).

Also, I asked and they said if there are any databases on there, their so old I don't have to worry about them. So maybe I don't even need MySQL installed, idk.

Last edited by anon091; 09-05-2014 at 10:55 AM.
 
Old 09-05-2014, 10:54 AM   #11
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
Step 4 of that link has a clue.
Every host must have a DocumentRoot, and sometimes they even point to the same place on the host

While it doesn't illustrate L.A.M.P. http://www.server-world.info/en is a great resource.
 
1 members found this post helpful.
Old 09-05-2014, 11:00 AM   #12
anon091
Senior Member
 
Registered: Jun 2009
Posts: 1,795

Original Poster
Rep: Reputation: 49
Thanks guys. I got my base CentOS installed, its updating now. Then i'll do my basic configs/tweaks, then see if I can get Apache, MySQL and PHP installed and at least displaying some pages. Here we go...
 
1 members found this post helpful.
Old 09-05-2014, 11:13 AM   #13
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
You're showing you're actively doing & learning stuff and that's commendable.
 
1 members found this post helpful.
Old 09-05-2014, 11:20 AM   #14
anon091
Senior Member
 
Registered: Jun 2009
Posts: 1,795

Original Poster
Rep: Reputation: 49
Thanks. I'm really trying to figure this out here. Have a quick question about php though. When I look at the current server and do a
rpm -qa |grep php-
php-4.3.9-3.36
php-ldap-4.3.9-3.36
php-odbc-4.3.9-3.36
php-mysql-4.3.9-3.36
php-pear-4.3.9-3.36

that's what I get. But does that necessarily mean those are things I need since before that was all in xampp, and now i'm trying to do it sans xampp? really I think the only php on this site is in forms to send emails, so i'm thinking maybe I give it a go with just php and not all the php-extras (also going under the impression I can skip MySQL).
 
Old 09-05-2014, 01:07 PM   #15
anon091
Senior Member
 
Registered: Jun 2009
Posts: 1,795

Original Poster
Rep: Reputation: 49
Quick update. Got the base server where I needed it (mostly, didn't go too crazy cuz I didn't want to leave you guys hanging), installed apache and php, made a test php info file (stole idea from that link I posted) and a test mail form php file in /var/www/html, the php info file displays php info, and the mail form when I submit I see some action in /var/log/maillog. I didn't get the email, but maybe I have to configure something differently for it to work through the vm through my machine to the mail relay, but the fact that it's actually doing something in the log is a positive sign!

Now I need to figure out how to undo all the xampp stuff on my real replacement server, then go this route. Reading online it looks like supposedly all I need to do is a rm -rf /opt/lamp.

Actually, this is way easier than trying to get xampp going to. And here everyone told me xampp made things easier...
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Simpler alternative to PHP to handle email form? littlebigman Linux - Software 7 12-06-2013 08:32 AM
Have Apache send email when my website is accessed? dilettante9 Linux - Server 4 06-25-2012 12:08 PM
[SOLVED] How to find URL for xampp website on my server anon091 Linux - Newbie 2 03-02-2010 09:01 AM
Migrating from Lotus Domino Email Server 6.5 to Linux email Server sailu_mvn Linux - Software 0 08-22-2006 11:04 PM
PhP Problems (email form) webwolf70 Programming 5 10-14-2005 05:13 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 03:56 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration