PHP working / not working depending on the host



Dear all,

i'm very new to the PHP coding so i'd really appreciate if any of you can help me to fix out this issue i'm having:

I've created a HTML form (standard newsletter subscription form with name, email, etc.) and its own related PHP script meant to send out subscriber's data to my email address.
I've uploaded the stuff to an hosting service i already own, in order to test it, and it works perfectly. I receive an email with the subscriber's data, and that's fine.

I've then tested this same one on another hosting service, and it's not working.

I've looked around for solutions, but cannot find any so far.

Is that possible that the problem is connected with MySql maybe? As far as i know, MySql database is installed on the first hosting service, not on the second...

It depends on how you have set your script up and if you use a database.

The other thing maybe what you use to send the mail - if one server uses the one you have used and the other doesn't, you have found your problem.

use the phpinfo() function to compare each server.
Thanx for the info Hyper.

Honestly, i have no idea what i use to send the email - i simply uploaded the html + php files via ftp, that's all...

I've used the phpinfo() function as well, but i i'm unable to find out where the issue is...too many different settings :-(
With the results of phpinfo() on the screen in the browser, use the find function (of your browser, ctrl+f) and look for "mail"
Hi Hyper,
it's not about me not wanting to bother myself looking's just that i'm very new to all this kind of stuff, and i understand 1% (maybe) of when looking at the phpinfo.php data, i hardly understand a few lines of it only...

BUT: i've just searched for "mail" on it, as you suggested, and it came out what follows:

mail.add_x_header --> Local Value: Off / Master Value: Off
mail.force_extra_parameters --> Local Value: No Value / Master Value: No Value
mail.log --> Local Value: No Value / Master Value: No Value

And maybe, this is more interesting:

sendmail_from --> Local Value: No Value / Master Value: No Value
sendmail_path --> Local Value: /usr/sbin/sendmail -t -i / Master Value: /usr/sbin/sendmail
Path to sendmail --> /usr/sbin/sendmail -t -i

Do any of this lines can be of any help?

Thanx in advance.
I don't have the access to all the information you have, so it's up to you if you provide this forum with what you think might help yourself, cryptic - ambiguous information will not get answers quickly.

Do the free hosts allow you to send mail from them? I haven't used one so I don't know.

The mail functions in php are one of the trickiest to use and get right, mostly caused by blindly copying out of date scripts, have a look and see if you can use PHPMailer or SquirrelMail.

Below this line is my signature, not to be confused by my answer which is above this line - although it still applies.
If your PHP script relies on a MySQL database, the issue you're facing on the second hosting service might be due to the absence of MySQL support.

To confirm if this is the problem, check your PHP script for functions like mysql_connect(), mysql_query(), or mysql_select_db(). These functions indicate the use of MySQL.

If the second hosting service doesn't offer MySQL, you have two options:

  1. Check if they provide an alternative database solution like PostgreSQL or SQLite. If they do, you'll need to modify your PHP script to work with the supported database.
  2. Modify your PHP script to send subscriber data directly to your email using PHP's mail() function. Remove any database-related code and configure the email details to include the subscriber's information.
I hope this explanation is easier to understand!
If you want to enjoy your time in mahipalpur, you need to hire a Call Girl In Mahipalpur that can cooperate with you both physically and psychologically if you want to enjoy your time with her. At delhinight, we offer you the top-notch service that you deserve. Our girls have received specialised training to fulfill your fantasies of a magical place where you can use your wand to accomplish anything. You can also hire our Escort Service In Vasant Kunj to enjoy in private.