Cant see any changes on browser when modify code YII - php

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.

Related

Wordpress displaying old PHP errors

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.

laravel asset-pipeline doesn"t load jquery

I'have instaled codesleeve/asset-pipeline and use command php artisan assets:update
got no errors, but when I load the page an in my chrome developer tools go to Network tab there is jQuery-1.10.2.min.map 404 not found
could please someone tell me if I forgot to do something?
Normally, a minimized source file will be unreadable since all the whitespace & comments are removed. The .min.map file allows the client to "rebuild" the original source for the purposes of browsing & debugging. Thus, if you want/need to debug jQuery, you might want to get that file.
If that file is missing, your application should still work properly. So, the short answer to your question is "no, you didn't forget anything". You can safely ignore that warning.

Why include prevents a php page to load?

I have my index.php page and just afrer my header i want to include a message.php file.
This message.php file executes some mysql queries, runs a couple of functions and in the end makes echo of some text.
If i go to mysite.com/message.php - i can see all the text i need in my browser. But if i add the following line:
<?php include "message.php"; ?>
to my index.php, the page loads only until the include statement and then produces 500 internal server error. How is that even possible? I'm totaly stuck here...
EDIT: I've figured it out, thanks for pointing me to the right direction with apache logs. Even though i didn't have the log access, i've made the edit to .htaccess with a statement php_value error_log log.txt. It dumped the error in the txt file in the same directory. The error was produced by a function that was a name that was already in use. That's why a separate enviroment wasn't producing the error.
Add the following to the top of your message.php:
ini_set('display_errors',1);
error_reporting(E_ALL);
As everyone has said, there is probably a simple error (maybe a missed quotation mark) that is throwing the error, but in that environment, it gets thrown as a 500 error rather than output to the screen. Enabling the above should reveal the problem.
As dm03514 pointed out, it might be that there's something in your message.php which is breaking your code. If there's a fatal error in that file, it'll cause a similar error in your main file.
Ask support for your error_log - this really helps debugging.
This is possible becuase you have an error in your message.php file! The next step is to figure out what is throwing the error. You can look at your web servers error logs to see the exact line. To solve this problem you only have to focus on the code in your message.php file.
Well, if you don't have access to the log files, try to run the same file in any other environment where you can see the errors.
That's the only way available.
Asking strangers to tell you what error you have in your php file makes very little sense, you know ;)
Try to make a copy of index.php, say copy.php, insert a test.ph include, displaying just some "KILLROY WAS HERE".
If that does work, go for <?php echo "..."; ?>.
if that does not work, place the include elsewhere and/or remove code.
One cause could be a hidden redirect, blocked because output already happened.
More likely some global variable was shared.

Index.php doesn't work on VPS but other files do

I've got really interesting problem with my VPS.
I've already installed www server using this instructions set: http://wiki.debian.org/LaMp and everything looks fine, but index.php file doesn't work.
It's main file of whole service and it's contains some initializations and includes. When I add there some echo, it display correctly. It seems that include function doesn't work.
Phpmyadmin works fine, other php files works but no index.php. I'm pretty sure it's not problem with file because it works great on old hosting.
Any ideas? I've searched the net, reinstalled everything twice but still i don't have any solution and i'm starting to feel helpless. If you need some additional information - ask.
My main guess is, that it throws an error which is not displayed.
Try adding this to the top of your PHP file:
error_reporting(E_ALL);
ini_set('display_errors', '1');
that should show you all the errors.
alternatively, you can check your error-log

php file not outputting results

I have developed a script but whenever i open admin panel it shows just a blank page, however the same script works fine on my another server. I tried changing chmod of files and folders 644, 755, 775 and 777 but still it outputs a blank page.
The main script works fine but its only admin panel thats not working. I check .htaccess also same on both servers.
Any idea what is wrong?
Thank You.
Check the error log of your HTTP server (e.g. Apache). In 99% of cases of a blank page, PHP has experienced a fatal error and exited before generating any output.
If this script works on another server, I'd check that the script can find everything it needs to include or require. Files not found are common fatal errors when moving a script from one environment to another. For instance, if you deployed the file to the new server without configuring the include_path correctly.
Re your comment about the notice you got:
Notice: Undefined index: submit in /var/www/admin/index.php on line 8
the function on line 8 is if($_POST['submit'] == 'Login')
This means your $_POST array does not contain a field 'submit'. Referencing a non-existant array index in PHP is an E_NOTICE. You can fix this in the following way:
if (array_key_exists('submit', $_POST) && $_POST['submit'] == 'Login')
put this at the top of your admin page
ini_set('display_errors',1);
error_reporting(E_ALL);
The servers probably have different things installed which is causing an error that you can see.
This may sound stupid, but seeing as you all you said was it "outputs a blank page", are you sure there's no output at all? Have you checked the page source, just in case? Remember that if your page starts with a bad HTML tag or something similar, there will be output but that doesn't mean anything is actually rendered in the browser.
Also make sure output buffering isn't on... I can't remember if this can cause issues when trying to debug, but who knows?

Categories