I have a WP site, I installed Insert-PHP plugin. (I am really new to WP).
On a new page I wrote in the "text" tab:
[insert_php]
require_once(realpath($_SERVER["DOCUMENT_ROOT"]) ."/firstfolder/nextfolder/test-1.php");
[/insert_php]
Then, in "/firstfolder/nextfolder/test-1_1.php" I have:
<?php
print 'something';
?>
At first I had problems w/ require_once because the path wasn't good. Then I managed and the page was working fine, displaying the word "something" as content.
A few hours later it's not working anymore. If I write PHP code between [insert_php] tags it's doing fine, but if I do the same thing in "test-1.php" nothing happens. No errors or warnings, nothing, just a blank page.
I even tried to write code to force an error and nothing happened. I cleared the cache, I tried created another file w/ that code ... nothing. I intentionally misspelled the path in require_once and that did produce an error.
The only thing happened between the time the code was executing and now is that I installed a "Yoast SEO" plugin.
What could have possibly happen? :(
So, thank you very much for support :| that was great.
I must say that I did not solve the mystery. Maybe I did something wrong somewhere or there is an issue with the "Insert PHP" plugin.
I'll write here what solution I came up with, maybe someone in the future will find a similar problem.
I installed another plugin called "Include Me". I used that to enter the path to the needed php file and after that everything was fine.
Related
So, I've been trying to do the Wikipedia url thing! Like making the url readable. Tried every .htaccess code out thire and contacted the Hostinger customer services to help, and nothing works! I don't know why.
So, i move to use the PHP, and i got work great on test.php page that i use the test on, but when i move the code to index.php it doesn't.
So, the why i did it is having a page with php simple code: if url[2] has s include s.php, else include x.php. and it works great when i go to www.website.com/test.php/s it will open s.php
However, when after i move the code to index.php and then i go to website.com/s i got an error as this page is not in the srver, but if i go to website.com/index.php/s it works.
So what do think i could fix it with? Or if there is any other why to do it. Thanks in advance ☺
I have to debug a wordpress site. The backend throws an 404 error on an existing file. (permissions checked, 777 on it did't help)
I can call the url in my browser, the script is shown, but the console still shows the 404 error.
The problem presumably exists since a redesign, where the previous template was copied and edited, but I did not touch the certain files. I can still call the script url from the previous template, it works fine.
The url where the error occurs is: https://sunball-tennis.de/wp-content/themes/sunball%20blue/assets/js/admin.js.php
I'd appreciate any help.
Update 1:
This is how the script is called:
<script type='text/javascript' src='https://www.sunball-tennis.de/wp-content/themes/sunball%20blue/assets/js/admin.js.php?ver=5.0.2'></script>
Update 2:
The call for the script is generated with this code:
wp_register_script('frontact_admin_js', get_bloginfo('template_url').'/assets/js/admin.js.php', array('jquery-ui-resizable', 'jquery-ui-draggable', 'jquery-ui-sortable', 'media-upload', 'thickbox', 'farbtastic', 'jquery-tools-tooltip', 'jquery-uniform'), false, true);
But as I said: It was exactly the same code and files in the previous template and it also still works when I activate the previous template, but not in the actual one. Driving me nuts.
All right I've found an answer. In the beginning of the admin.js.php script was a request for wp-blog-header.php which did not work for unknown reasons. Fixed it with adding
status_header(200);
nocache_headers();
after the request.
Got the solution from: https://wordpress.org/support/topic/integrating-wp-in-external-php-pages/?replies=22 and https://wordpress.stackexchange.com/questions/85384/mysterious-http-404-header-in-my-own-scripts
Cheers!
Within /wp-admin/theme-editor.php, I added some PHP in an attempt to create my own shortcode. When I clicked save:
Parse error: syntax error, unexpected 'post' (T_STRING) in .../wp-content/themes/phenomenon/functions.php on line 21
Indeed, this same error appeared if I tried to go even to the main page of my site. Having no way to go back into the editor and remove the newly added code, I uploaded a backup copy of functions.php via FTP. My site started loading again. Yet when I went into /wp-admin/theme-editor.php, this error still appeared, even though functions.php doesn't have 21 lines of code.
Here is the current / original functions.php:
<?php ?><?php
require_once (TEMPLATEPATH."/scripts/theme-js.php");
include (TEMPLATEPATH."/scripts/custom-scripts.php");
include (TEMPLATEPATH."/scripts/breadcrumbs.php");
include (TEMPLATEPATH."/scripts/write-panels.php");
include (TEMPLATEPATH."/bluzpanel/theme_options.php");
include (TEMPLATEPATH."/includes/shortcodes.php");
include (TEMPLATEPATH."/includes/wp-pagenavi.php");
include (TEMPLATEPATH."/includes/custom-widgets.php");
include (TEMPLATEPATH."/includes/register-sidebars.php");
?>
EDIT: I have verified that I can still use /wp-admin/theme-editor.php when I test it on another computer. Therefore the problem might be unique to my main computer, where I made the changes to function.php.
Magically, /wp-admin/theme-editor.php started working again. It might have been related to my browser somehow caching the the page with the error message, though I believe tried another browser on the same computer and got the same error. Anyway, refreshing the page several times might be the solution.
I know this has been discussed a lot throughout the Stackoverflow.
But still I can't make it work for me, I've been searching for hours, no joke.
I always make my index.php page like this:
<? include ("header.php");?>
<? if($_REQUEST['p']==''){ include('home.php') }
if($_REQUEST['p']=='atelier'){ include('atelier.php'); }
if($_REQUEST['p']=='quem_somos'){ include('quem_somos.php'); }
if($_REQUEST['p']=='que_criamos'){ include('que_criamos.php'); }
if($_REQUEST['p']=='projetos3d'){ include('projetos3d.php'); }
if($_REQUEST['p']=='noticias'){ include('noticias.php'); }
if($_REQUEST['p']=='localizacao'){ include('localizacao.php'); }
if($_REQUEST['p']=='contactos'){ include('contactos.php'); } ?>
<? include ("footer.php");?>
It is supposed to always loads the header and footer.
On page opening it is supposed to load the home.php because there's no request and the menu of the website has links that are requests to other pages.
This always worked for me, I used to work on a ftp server but now I'm using XAMPP for this and it seems like the includes are not working at all.
Is there any file I could go and change some permissions or even better change the way I include the files to be supported on XAMPP?
EDIT: For those asking about how REQUEST works, I have a sample here, it might be easier to understand if you see the menu working: link
EDIT 2: By not supporting I mean: it displays a blank page, it doesn't load neither the header/footer nor the pages themselves
EDIT 3: I've enabled short_open_tag and allow_url_include in php.ini, still not working.
EDIT 4: I went to try easyphp and I still got the same problem... I'd rather not move from where I am and keep the XAMPP to find a solution for this.
I have a website that is finished and uploaded, at first it works fine but after a while it stops working.
By stops working I mean whatever page I go to just shows a blank page, empty source.
In Chrome though, I get HTTP Error 500 (Internal Server Error)
To fix this all I need to do is change debug to 2, refresh and then change it back to 0.
I do not know what triggers this to happen, I have tried clearing the cache folders.
There are no log entries in /app/tmp/logs/error from the last week.
Any ideas would be great. Thanks.
In the end it was APC cache conflicts between multiple Cakes on the same server.
All I had to do was change $prefix in config.php and it worked.
Cakephp can show also blank page, if you have some component included in your controller and it contains error, and if for some reason debug does not work(though debug level in core.php is 2 or 3 ) in your component , it just shows blank page.
this post is getting old, but today I upload a new website to a server and get the blank page so I share my experience. I have no access to server logs so I was stuck. I was very confused because that server has running another sites with cakephp so I think the problem was mod_rewrite. After several ours of testing the problem was that the server's php version was too old to run cake 2.8.3. so I use an older version of cake and everything works fine. Hope this help someone.
Happened to me when I had a constant defined, did not notice this and defined another one with the same name.
const VISIBLE = 1;
const DELETED = 0;
const VISIBLE = 1;
A few years later I will add a comment here:
This would mean there was a syntax error, make sure u display these.
It might be due to white space in end of file
Please check your all files if white space is there after ‘?>’ tag it redirects it to blank page
or you can remove ‘?>’(closing php tag) to remove this problem.
In my case i had
public function appError($error) {}
on AppController which was supposed to redirect to a 404 page and i commented the redirect. this led to me having blank page.
In my case the problem was not the cache.
Enabling CakePHP debug should be useful. Change the value to
Configure::write('debug', 0);
to
Configure::write('debug', 1);
in app/cake/core.php
to show the real errors.
I had the exact same problem, it was the folder app/tmp/cache/models that didn't exist. After creating it, no more problem.