I have a website on Wordpress and I developed some theme options in my functions.php file of the theme folder.
Everything it`s fine on my localhost, but on server I get a white page when I save the options and also some url's don't work anymore.
I developed this code from some tutorials and the problem might be the php functions used, might be to old, or to new?
Here it is, not long!
http://pastebin.com/mKJYuUE2
OW, and the admin shows my options and saves them in database!
Edit after debug on!
I get an error like this Notice: Undefined index: action in "blabla" on line 63 and 93, 94 same error. I think this $_REQUEST['saved'] is the problem, but I don't even know what this does.
Thank you very much!
Edit after debug the code
Now I fixed all my wordpress errors. Everything looks fine in my admin options, but now the problem is that if I try to delete a post, or some submit actions, I will get a white screen. On localhost I dont have this problem.
On my functions.php even if I add an echo line will give me this white page. What can I doo???
UPDATE:
Since you now know the error message. On line 63 it says "save," but line 93 says "saved." Might this inconsistency be the error?
To show error messages, add the following line to your .htaccess file:
php_flag display_errors on
That way you will see the specific error message so you will know where the problem lies specifically. Alternately you can add the following line to your wp-config.php file:
define('WP_DEBUG', true);
That should also display error messages. This will help pinpoint the problem.
My guess is you don't have short_open_tag enabled in your php.ini file on the server. Try changing the <? on the first line to <?php.
It's widely considered best practice to disable short_open_tag and use the longer <?php form instead. One of the main reasons is that it makes outputting XML a lot simpler because XML documents start with <?xml which conflicts with PHP's short opening tag.
Related
I have a WooCommerce website that has been created by other party. When I was editing a template file and checking a minor change, a PHP error appeared on top of the page (literally the first line in the document, above )
[12-Jun-2017 19:08:58 UTC] PHP Fatal error: Call to undefined function add_action() in /home/SITENAME/public_html/wp-content/themes/booklovers/widgets/top10.php on line 8
I do know what it means, but it appears that the error itself is not the issue. The time does not change, it constantly displays 19:08:58. I've also tried renaming/moving the file to see what happens - and nothing happens at all. It is being executed, because the page results with a white screen when I put exit; in it. Renaming made no difference. Checking this path by file_exists() called in index results with false. In my opinion it has something to do with Wordpress, because if I put exit; on top of the index.php the page is totally blank, without error, so it is not being merged with the response by Apache or something. Also setting the error reporting in index/config has no effect (I realize that this is generally a bad idea, and would not leave production with a workaround like this).
My guess is that the error might be some kind of a cached artifact. But this WooCommerce has no cache plugins installed so far... I have only a minor experience with Wordpress, I do know the basics, but debugging this type of issues is a terrible pain. I would appreciate any tips suggesting where should I look.
Additional information worth mentioning: shared hosting on GoDaddy (not my choice...), php 5.6.
Resolved. A theme's error_log file was being prepended to the response.
I have a problem with my wp-admin as it is saying that:
ERROR: Cookies are blocked due to unexpected output. For help, please see this documentation or try the support forums
I have tried all possible ways to fix it but I am unable to fix this problem so I need your help . The ways I tried are:
Changing the theme into default.
Deactivating the plugins.
Re-configuring the WP-Config.php file.
Did Wp-debug value , true.
Had given a closing tag in function.php file as well.
Friends my project is running well in localhost and in live the project is running but its backend is not working
There are a few possible situations that are capable of creating this error:
UTF-8 => are your files UTF-8? no BOM (have you opened live files with Notepad ++?), more info about this problem
Remove all plugins, try again to log in (to make sure there is not a plugin creating the "headers already sent by ...)
The same goes for Themes
remove the closing ?>in functions.php
In functions.php, please remove the ?> from end if it exists.
I found the answer to my question after long struggle.
1. I put a function in wp-config.php file
function : ob_start(); just above my WP-DEBUG function.
2. I changed my hosting service as there was some kind of virus in the server which was automatically changing the file permission of index.php and .htaccess files.
Finally my site is live and I am very happy for that and Thank You everyone who helped me in solving my problem.
Best Regards,
Chetan
To fix the bug:
Open file blog/wp-admin/includes/screen.php in your favorite text
editor.
On line 706 find the following PHP statement: <?php echo
self::$this->_help_sidebar; ?>
Replace it with the statement: <?php echo $this->_help_sidebar; ?>
Save your changes.
Hope it helps you.
Hi I have got project where I have to do some changes, but then I do some changes in php files I can't see any changes in web browser, only then I deleted files, when I see error in windows, but if I comment all lines from same file, and want see changes, when I refreshed the page where will be page like before, what means I see page like normally, and if I download the file and open it I see commented lines.
So I am using YII framework, I understand that I should turn on debugging on, so in [project-name]/index.php file in the top I pasted code.
defined('YII_DEBUG') or define('YII_DEBUG',true);
But it didin't work for me, still can't see any changes.
I also try ctrl+f5 on page refresh.
Maybe I should look in to Apache configuration?
If some one know please help.
I believe that defined('YII_DEBUG') or define('YII_DEBUG',true); causes a debug dump to be sent to the screen when an exception is thrown. Without that code there will be a single line exception error.
Recently I moved a website to a new server. The website was working perfectly on the shared server, but I've encountered a host of permission issues and other problems since relocating to EC2. I have changed the ownership of the /var/www/html folder to apache to allow altering altering of settings on the back end of WordPress. Strangely enough, I am able to create new posts, but when I attempt to update an existing page or create a new one, I receive a blank page. [http://example.com/wp-admin/post/php] Originally I thought it was yet another permission based issue, but after researching that doesn't appear to be the case.
Steps I've taken thus far:
1) Changed ownership of the directory to apache
2) Disabled all my plugins
3) Added : php_flag output_buffering on to .htaccess (Although I wasn't sure if it mattered where in the .htaccess file I should put that command)
From the research I've done it appears that white space after the ?> could be the cause. Anyone know how I could tell which file would have this white space? Several of my files actually do not even have the PHP close tag. One additional note, my previous server was version 5.2.17 to 5.3.20. Any other ideas?
After checking the error logs I discovered that I was missing the mbstring PHP library, which has a function that was called by one of my theme files. Once added I was able to create and alter pages on the backend of WordPress without issue.
To all the folks who get this kind of error of page not displaying must check option.
turn on error reporting if you have commented the lines in your wp-config.php
#ini_set('display_errors','Off');
and than check for error.
if it has the error like this
PHP Warning: Cannot modify header information - headers already sent by (output started at /[server info]/wp-config.php:77)
than check your wp-config.php for extra space at top and bottom of the page.remove extra line spaces even. and than re-upload the wp-config.php.
Most of time this will solve your problem.
Happy Coding!!!!
I had a similar problem and by removing extra spaces before the "< ?php" fixed the issue. Although apparently it was a different theme functions file that was causing the issue. Make sure you look at the php file referenced in the php warning. In this example, it's 'wp-config', but it could be really anything.
PHP Warning: Cannot modify header information - headers already sent by (output started at /[server info]/wp-config.php:77)
Good luck!
Basically this issue happens because you have edited the file directly on cpanel editor or other simple text editor. Just create a new .php file and paste your post.php code in that file. Now save this file and replace this new one with old post.php.
Total newbie here, so take it as you will...
I'm doing a site upgrade right now, and everything works fine except...
I have a WordPress installation in a subdirectory, and now that I've brought the main site live, I'm getting
include(/settings.php) [function.include]: failed to open stream: No such file or directory
and
include() [function.include]: Failed opening '/settings.php' for inclusion (include_path='.:')
on includes from within the subdirectory. I've played with setting different include_path settings, I know for sure the files are there (they are being included with no problems from the root directory), and I'm changed no permissions or anything during the rollout of the site.
Please let me know if this question is improper, or misplaced, or too vague, or what have you - first post after months of googling and lurking.
thanks in advance!
You're likely using php in a chrooted environment, so the root path of the server doesnt match that of the script.
Regarding the variables scope issue, could you post some sample code?
"/settings.php" points to the root of your server. It should be "settings.php" if it is on the same path and it should be in quotes.
Cheers
I would recommend adding define('WP_DEBUG', true); to your wp-config.php file and report back with more information. Make sure to undo this any you grab the info for debugging as having this on a live site could be a security risk. I just search my whole WP directory for include( "/settings.php" ); and could not find anything, which makes me think that it make be an issue with a plugin, theme, or other custom code. You could troubleshoot this by disabling all of your plugins, seeing if the site works again, and then painstakingly enabling your plugins individually until you find the culprit.
Does the error message you get point to a specific file and line number? That can help debug the problem.