Found this error when I opened my Wordpress panel - php

Found this error when I opened my Wordpress panel:
Warning: Invalid argument supplied for foreach() in /home/cactusbo/domains/cactusbook.com/public_html/wp-content/plugins/jet-engine/framework/jet-dashboard/inc/plugin-manager.php on line 148
Warning: Invalid argument supplied for foreach() in /home/cactusbo/domains/cactusbook.com/public_html/wp-content/plugins/jet-engine/framework/jet-dashboard/inc/plugin-manager.php on line 148
Warning: Cannot modify header information - headers already sent by (output started at /home/cactusbo/domains/cactusbook.com/public_html/wp-content/plugins/jet-engine/framework/jet-dashboard/inc/plugin-manager.php:148) in /home/cactusbo/domains/cactusbook.com/public_html/wp-admin/includes/misc.php on line 1416
Warning: Cannot modify header information - headers already sent by (output started at /home/cactusbo/domains/cactusbook.com/public_html/wp-content/plugins/jet-engine/framework/jet-dashboard/inc/plugin-manager.php:148) in /home/cactusbo/domains/cactusbook.com/public_html/wp-includes/functions.php on line 6865
Warning: Cannot modify header information - headers already sent by (output started at /home/cactusbo/domains/cactusbook.com/public_html/wp-content/plugins/jet-engine/framework/jet-dashboard/inc/plugin-manager.php:148) in /home/cactusbo/domains/cactusbook.com/public_html/wp-admin/admin-header.php on line 9
foreach ( $this->registered_plugins_data as $plugin_file => $plugin_data ) {
if ( $plugin_data['slug'] === $_args->slug ) {
$registered_plugin_data = $plugin_data;
break;
}
}
I searched but could not find any answer directly to my error. and I do not know a lot about php.

Related

Hi I want to read a parameter from a telegram table using telegram robot and send it to the user but my request fails

This is my function to query
function getUser($user_id){
global $db;
$query="select * from users WHERE user_id='$user_id'";
$res=mysqli_query($db, $query);
$res=mysqli_fetch_assoc($res);
file_get_contents($res);
file_put_contents('result22.txt', $res.PHP_EOL,FILE_APPEND);
}
This my case to send it by a message
case'information':{
$Stock=getUser($user_id)['Stock'];
$invited=getUser($user_id)['invited'];
$msg=urlencode("$invited\n\n$Stock");
send_message($user_id,$msg);
}
break;
The above causes the following exception:
Blockquote
file_get_contentshttps://api.telegram.org/bot984745149:AAH_g_Zuo9T****SDlS6_W7aISlsRAuCWY/sendMessage?chat_id=129372728&text=%0A%0A: failed to open stream: HTTP request failed! HTTP/1.1 400 Bad Request
in /home/v/public_html/New/bot.php on line 63
PHP Warning: file_get_contents() expects parameter 1 to be a valid path, array given in /home/v/public_html/New/bot.php on line 116
PHP Warning: file_get_contents() expects parameter 1 to be a valid path, array given in /home/v/public_html/New/bot.php on line 116'
Functions in question:
In your getUser function, you have:
$res=mysqli_query($db, $query);
$res=mysqli_fetch_assoc($res);
file_get_contents($res);
The $res here is an array representing a row in your table, while the file_get_contents expect the parameter to be string.
I guess, the url that you are trying to get is a field of that row in the table and you should write file_get_contents($res['fieldName']) instead.

No white spaces, but still getting Warning: Cannot modify header information - headers already sent [duplicate]

This question already has answers here:
How to fix "Headers already sent" error in PHP
(11 answers)
Closed 4 years ago.
I am creating an API, using PHP. I am getting the following errors:
Warning: Cannot modify header information - headers already sent by (output started at xxx/api/index.php:1) in xxx/api/index.php on line 2
Warning: Cannot modify header information - headers already sent by (output started at xxx/api/index.php:1) in xxx/api/index.php on line 3
Warning: Cannot modify header information - headers already sent by (output started at xxx/api/index.php:1) in xxx/api/index.php on line 4
Warning: Cannot modify header information - headers already sent by (output started at xxx/api/index.php:1) in xxx/api/index.php on line 5
Warning: Cannot modify header information - headers already sent by (output started at xxx/api/index.php:1) in xxx/api/index.php on line 6
There is not white-space above or below, still I am getting the warnings! Below is my code:
<?php
header("Access-Control-Allow-Origin: *");
header("Content-Type: application/json; charset=UTF-8");
header("Access-Control-Max-Age: 3600");
header("Access-Control-Allow-Methods: POST");
header("Access-Control-Allow-Headers: Content-Type, Access-Control-Allow-Headers, Authorization, X-Requested-With");
echo '{"abc":"abc"}';
?>
Any help will be appreciated!
PS: Why this is being marked as duplicate! I assume the problem is being caused by the headers! and all other questions are of different criteria!
Thanks
If this is the only file in your app, then try deleting the closing PHP tag (?>). If this is not the only file in your app, then you probably have white space in a different file, perhaps one that is requiring this one.

PHP Fatal error: Call to undefined method JDocumentError::close()

I've searched for a solution everywhere but I couldn't find an answer. Some days I got this error without change or do anything:
And I can't access my website in the entire day but suddenly starts working again without any change, and some days later the same problem. What can I do?
Internal Server Error
The server encountered an internal error or misconfiguration and was
unable to complete your request.
Please contact the server administrator at
webmaster#magic.kiwitextil.com to inform them of the time this error
occurred, and the actions you performed just before this error.
More information about this error may be available in the server error
log.
Additionally, a 500 Internal Server Error error was encountered while
trying to use an ErrorDocument to handle the request.
My site is: www.magic.cr
I can access to the backend always! (magic.cr/administrator)
I've checked my server logs and I got this lines repeating constantly:
[23-Aug-2016 16:44:53 UTC] PHP Deprecated: Non-static method
JApplication::redirect() should not be called statically, assuming
$this from incompatible context in
/home/kiwitex/public_html/magic.cr/templates/braink/error.php on line
9
[23-Aug-2016 16:44:53 UTC] PHP Notice: Undefined property:
JDocumentError::$_messageQueue in
/home/kiwitex/public_html/magic.cr/libraries/legacy/application/application.php
on line 376
[23-Aug-2016 16:44:53 UTC] PHP Notice: Undefined property:
JDocumentError::$client in
/home/kiwitex/public_html/magic.cr/libraries/legacy/application/application.php
on line 394
[23-Aug-2016 16:44:53 UTC] PHP Notice: Trying to get
property of non-object in
/home/kiwitex/public_html/magic.cr/libraries/legacy/application/application.php
on line 394
[23-Aug-2016 16:44:53 UTC] PHP Fatal error: Call to
undefined method JDocumentError::close() in
/home/kiwitex/public_html/magic.cr/libraries/legacy/application/application.php
on line 409
/home/kiwitex/public_html/magic.cr/libraries/legacy/application/application.php
Lines 376 to 409
if (count($this->_messageQueue))
{
$session = JFactory::getSession();
$session->set('application.queue', $this->_messageQueue);
}
// If the headers have been sent, then we cannot send an additional location header
// so we will output a javascript redirect statement.
if (headers_sent())
{
echo "<script>document.location.href='" . str_replace("'", "&apos;", $url) . "';</script>\n";
}
else
{
$document = JFactory::getDocument();
jimport('phputf8.utils.ascii');
if (($this->client->engine == JApplicationWebClient::TRIDENT) && !utf8_is_ascii($url))
{
// MSIE type browser and/or server cause issues when url contains utf8 character,so use a javascript redirect method
echo '<html><head><meta http-equiv="content-type" content="text/html; charset=' . $document->getCharset() . '" />'
. '<script>document.location.href=\'' . str_replace("'", "&apos;", $url) . '\';</script></head></html>';
}
else
{
// All other browsers, use the more efficient HTTP header method
header($moved ? 'HTTP/1.1 301 Moved Permanently' : 'HTTP/1.1 303 See other');
header('Location: ' . $url);
header('Content-Type: text/html; charset=' . $document->getCharset());
}
}
$this->close();
/home/kiwitex/public_html/magic.cr/templates/braink/error.php
Lines 8 to 10
case "404":
JApplication::redirect("index.php/404-error"); // replace the redirect URL with your own
break;
Please help I cannot access my site in the last 36 hours!!!

HTML2PDF Not work in hosting, but work in localhost

This my error:
Strict Standards: Declaration of FPDF_Alpha::Image() should be compatible with FPDF::Image($file, $x = NULL, $y = NULL, $w = 0, $h = 0, $type= '', $link = '') in /home/stekomin/public_html/ujian/html2pdf_v3.31/_mypdf/03_fpdf_alpha.class.php on line 21
Warning: Cannot modify header information - headers already sent by (output started at /home/stekomin/public_html/ujian/html2pdf_v3.31/_mypdf/03_fpdf_alpha.class.php: 21) in /home/stekomin/public_html/ujian/html2pdf_v3.31/_mypdf/03_fpdf_alpha.class.php on line 1017
FPDF error: Some data has already been output, can't send PDF file
You should disable to show errors on your production server:
ini_set('display_errors', '0');
error_reporting(E_ALL | E_STRICT);
The first line disables showing the errors to the user, the second line though enables the logging of these errors.
Cannot modify header information - headers already sent by ...
This error occurs because there is already content sent to the user ( your error message ) and FPDF wants to set header information, which must happen before content is sent.

WP REST API query multiple post types

I am trying to retrieve posts from multiple post types using WP REST API. I have no problem getting a feed from one post type book by doing this:
http://example.com/wp-json/posts?type=book&filter[posts_per_page]=10
Now I want to extend the feed to get book and movie. This only gives me the last specified type:
http://example.com/wp-json/posts?type=book&type=movie&filter[posts_per_page]=10
This gives me an error:
http://example.com/wp-json/posts?type[]=book&type[]=movie&filter[posts_per_page]=10
How should I be handling this?
Thanks!
Edit: Fixed syntax to match what I actually have. Here are the errors that I get when this syntax http://example.com/wp-json/posts?type[]=book&type[]=movie&filter[posts_per_page]=10 is used:
Warning: urlencode() expects parameter 1 to be string, array given in /home/newbreak/public_html/wp-includes/formatting.php on line 4128
Warning: Cannot modify header information - headers already sent by (output started at /home/newbreak/public_html/wp-includes/formatting.php:4128) in /home/newbreak/public_html/wp-content/plugins/json-rest-api/lib/class-wp-json-server.php on line 587
Warning: Cannot modify header information - headers already sent by (output started at /home/newbreak/public_html/wp-includes/formatting.php:4128) in /home/newbreak/public_html/wp-content/plugins/json-rest-api/lib/class-wp-json-server.php on line 587
Warning: Cannot modify header information - headers already sent by (output started at /home/newbreak/public_html/wp-includes/formatting.php:4128) in /home/newbreak/public_html/wp-content/plugins/json-rest-api/lib/class-wp-json-server.php on line 587
Warning: Cannot modify header information - headers already sent by (output started at /home/newbreak/public_html/wp-includes/formatting.php:4128) in /home/newbreak/public_html/wp-content/plugins/json-rest-api/lib/class-wp-json-server.php on line 587
Warning: Cannot modify header information - headers already sent by (output started at /home/newbreak/public_html/wp-includes/formatting.php:4128) in /home/newbreak/public_html/wp-content/plugins/json-rest-api/lib/class-wp-json-server.php on line 587
Warning: Cannot modify header information - headers already sent by (output started at /home/newbreak/public_html/wp-includes/formatting.php:4128) in /home/newbreak/public_html/wp-content/plugins/json-rest-api/lib/class-wp-json-server.php on line 587
I only get the errors when I send the type as an array type[].
You can also try registering an additional endpoint so you don't have to add as many query arguments in each request. I'm using the latest version of the WP REST API plugin.
So for a custom content type called "movies", you could have an endpoint like wp-json/wp/v2/movies
add_action('rest_api_init', 'register_movies');
function register_movies() {
$movies_custom_fields = array(
'director',
'genre'
);
foreach ($movies_custom_fields as $key) {
register_rest_field('movies', $key, array(
'schema' => null,
'get_callback' => 'get_movies_data',
));
}
}
function get_movies_data( $object, $field_name, $request ) {
return get_post_meta( $object[ 'id' ], $field_name, true );
}
More documentation on adding custom endpoints for different content types at the WP REST API V2 documentation site.
We had a similar requirement, where we only had a slug and need to query / find the post/page/article data.
We have build a wordpress api v2 plugin to query multiple post types.
Here is the plugin code https://github.com/elevati/wp-api-multiple-posttype

Categories