Context:
I am using Amazon Web Services to build and run a Wordpress site.
Issue:
The problem I have is with sending e-mails from the site. I also installed the plugin "Post SMTP". The error message I am getting is "Email could not be resent. Error: Unable to send mail. ".
What I tried so far:
I reached out to AWS and they wrote me to use Amazon SES service. I have created and configured an identity on SES. The issue is still there.
I don't know where to look anymore. Can anyone help who faced same or similar issues?
Thanks!
Check if the phpmail function is working properly. You can use the following code to check it.
<?PHP
$sender = 'someone#somedomain.tld';
$recipient = 'you#yourdomain.tld';
$subject = "php mail test";
$message = "php test message";
$headers = 'From:' . $sender;
if (mail($recipient, $subject, $message, $headers))
{
echo "Message accepted";
}
else
{
echo "Error: Message not accepted";
}
?>
Create a php test file using a text editor and save it e.g. as test.php
Change the $sender and $recipient in the code.
Upload the php file to your webserver.
Open the uploaded php file in your browser to execute the php script.
The output show either "Message accepted" or "Error: Message not accepted".
If it's showing "Error: Message not accepted"Tell your provider that the standard php "mail()" function returns FALSE.
It's recommended to include the used php test script to show your provider, that the problem is not caused by the php script used.
Related
I'm trying to create a schedule script php from PLESK but i have a problem when i've use get_field() function from ACF.
Plesk retriew the error:
" PHP Fatal error: Uncaught Error: Call to undefined function get_field()..... "
I have the same problem with all function called from Wordpress.
The code inside the PHP script is:
$my_var = get_field('indirizzo_ip','options');
echo $my_var;
Can someone help me?
Thanks
Include these files at the top of your script and you`ll have all the WordPress functions available:
define('WP_USE_THEMES', false);
require('/path/to/your/httpdocs/wp-blog-header.php');
require('/path/to/your/httpdocs/wp-admin/includes/admin.php');
Regards Tom
We have used stripe payment using PHP. It works on the local machine but in live server, it's not worked as expected. We shared the code which we used and also attached the screenshot of the error. Not sure where we made the mistake, can you guide us?
Stripe Code :
require_once('Stripe.php');
Stripe::setApiKey('secret key');
echo '<form action="" method="post">
<script src="https://checkout.stripe.com/checkout.js" class="stripe-button"
data-key="publish key"
data-description="Access for a year"
data-amount="5000"
data-locale="auto"></script>
</form>';
if($_POST) {
$token = $_POST['stripeToken'];
$customer = Stripe_Customer::create(array(
'email' => 'customer#example.com',
'source' => $token
));
$charge = Stripe_Charge::create(array(
'customer' => $customer->id,
'amount' => 5000,
'currency' => 'usd'
));
echo '<h1>Successfully charged $50.00!</h1>';
}
Local Machine
Live Server
1) It looks like potentially you haven't copied the data folder that comes with the stripe php bindings over to your server --- this contains the ca-certificates.crt file referenced in the failed loading cafile error. Make sure this folder is present on your server and see if that resolves the issue!
2) If you continue to have trouble the issue may involve an inability of your server to communicate over TLS 1.2 to Stripe. From your syntax it looks like you are using an older version of Stripe's PHP library so you'll want to use the second sample here to test that.
You can also run a test script like this to help determine your libcurl and openssl versions, if curl is able to make TLS 1.2 connections in the first place. If you need to upgrade curl and openssl some helpful advice is here. You can also chat with your sysadmin or web host on the matter.
In openshift this code
<?php
$connection = odbc_connect("Driver={Microsoft Access Driver (*.mdb)};Dbq=$mdbFilename", $user, $password);
~
returns
PHP Fatal error: Call to undefined function odbc_connect()
Can you use odbc_connect() on openshift?
I do not believe that OpenShift includes the iODBC driver, you can check for sure by creating a php page with the following contents and then checking it for iODBC support
<?php
phpinfo();
You should add your request to have iODBC support at https://ideas.openshift.com and get people to vote on it.
Hi I have use a magento wordpress single sigin plugin , for this in installation it is suggested to add this code in magento index file .
// for wordpress login
$adminwp = "/var/www/projects/magentowoo/index.php/admin";
$wploadwp = "/var/www/projects/arun/rohitgoel/wp-load.php";
$uri = $_SERVER['REQUEST_URI'];
//echo $uri;
if(!strpos($uri, $adminwp) && !strpos($uri, 'downloader')) {
require_once($wploadwp);
}
it works fine but it a strange issue, when i am adding the product image in admin it gives a error
Decoding failed: Syntax error
i have try to comment out this code and than image works properly. Please suggest how can i fix this
Update your browser Flash version, if Flash is being blocked by the browser as being outdated this error will occur on the website.
The code for download that works at localhost is but live at hostgather server it throughs error
ob_get_clean();
header("Content-type: text/x-csv"); # DECLARING FILE TYPE
header("Content-Transfer-Encoding: binary");
header("Content-Disposition: attachment; filename=".$csv_file_name); # EXPORT GENERATED CSV FILE
header("Pragma: no-cache");
header("Expires: 0");
echo $fields;
exit;
The error is
Warning: Cannot modify header information - headers already sent by (output started at /home/londoner/public_html/pkfones.com/pinquest/wp-admin/includes/template.php:1679) in /home/londoner/public_html/pkfones.com/pinquest/wp-content/plugins/wp-gamesize/setgamesize_admin.php on line 131
Make sure you're calling ob_start() at the beginning (or very close) of your code execution. This will buffer all your output and allow you send headers any time. You can probably just place this at the very top of your functions.php.
The reason this works on your local and not live is probably a difference in the server config, where locally you are buffering by default but not on live. This is a good reason to make sure that your development and production environments are as similar as possible.