Redirection not working in CakePHP 2 - php

I have an application and its working locally perfect.
on production, all pages are fine which haven't redirection.
Its connected with database because data showing on list pages
I have checked controllers/models for starting and ending code (spaces removed and closing PHP tag removed)
I checked permissions (all folders are 755 and tmp is 777)
I updated debug value to 2,3 but not showing any thing
I checked using PR few variables and in view source it shows few spaces (didn't get any clue that from where the spaces are embedding)
Also, I have uploaded fresh copy of lib/Cake
One another project in same version of Cake is already deployed and working perfectly (Prefix changed for both projects)
On redirection, it shows a blank page. I checked view source of this blank page and it contains 32 spaces.
Any Clue why its happening or from where I need to remove these spaces?

Issue fixed.
Because it was issue of IDE.
I am using sublime but same Dreamweaver have same issue.
For Sublime, we can load a package : https://github.com/SublimeText/TrailingSpaces
For Dreamweaver, we need to do manually by search and replace.
for more details : http://www.jaredstenquist.com/2009/02/13/removing-extra-linebreaks-and-spaces-in-dreamweaver/
Thanks

Related

Php: starting page of website shows blank screen

After upgrading my OS I can't access the main page of my personel little local website anymore.
Last month I upgraded my Debian Squeeze to Jessie. Before upgrading I had copied all php files, image folders and the mysql database to an external hard disk. After the upgrade I put everything back. At first the problem was that I didn't have permission to access the main page even though I own every file and folder that's connected to this site. A little chmod a+rx seemingly fixed this but when I go to the main page, all I get is a blank screen. I checked the website's folder and found that a number of files have a second version ending in .php~. I never noticed this before and I'm sure I didn't create those files myself. (Actually I found a reference in an old thread somewhere to some editors creating automatic backups with this extension. Guess that's what happened here.) These extra files only show up in a terminal, not in a file manager.
So there is a file named hoofdmenu.php (main page) and one named hoofdmenu.php~. Hoofdmenu.php is my starting page and it only shows a blank screen. In Firebug all you see is:
<html>
<head></head>
<body></body>
</html>
However, if I go to hoofdmenu.php~ I get my webpage (minus a function I defined but that's a minor problem). I can also navigate from the main page to other pages and between other pages. Only when I go back to the main page (every page has a return home button) I get the same old blank screen.
The only difference between both files is the indentation of a few blocks of code. Given that hoofdmenu.php~ works I tried copying this file to hoofdmenu.php but then again I get the empty screen. Can anyone tell me what I'm missing here?
Thanks in advance.
Checking /var/log/apache2/error.log pointed to an unexpected end of file. I don't consciously use short tags but I went looking for them just to be sure and found a stray semicolon:
<?php;
Removing said semicolon solved the entire problem including the unresponsive function. Apparently some previous version of something didn't mind (last alteration of the file was February 19 so it worked at least six weeks with the semicolon in place). Everything is now running again as it's supposed to.

Using Brackets for PHP files

I currently have wampserver running and I'm trying to do live preview of a php file using Brackets.io. However when I click live preview I'm getting
Project settings for: Getting Started
Live preview base URL: ______________
I'm following this tutorial on running PHP scripts.
My php file is in C:/wamp/wwww/php_proj1/php1.php so I've been trying to put this in my "Base URL"
http://localhost/php_proj1/php1.php
However everytime when I type that and enter it, it just asks me for the "Live Preview Base URL" again and nothing happens. I also tried putting the URL in my 'File->Project settings' and that also didn't work. I'm just running a basic php script that echos some words.
It works when I manually type
http://localhost/php_proj1/php1.php
in my Chrome URL but not when I use Bracets live preview.
What am I missing or doing wrong? Do I need to config anything in my wampserver? I've just started learning php and using wampserver so I'm not entirely sure what I'm doing wrong.
Thanks!
EDIT: I'm following these 2 tutorials on doing this and it's just not working for me.
tutorial 1 and tutorial 2
EDIT2: Found my mistake.. I did not do File->Open Folder to open the folder that I was working on... Thanks to everyone that helped me with this, I will definitely not make this mistake again. sigh
The Live Preview Base Url should be set to the same url that you would use to launch your project in a browser.
So if you have a project in C:/wamp/wwww/php_proj1/ you would launch that project in a browser by entering http://localhost/php_proj1/php1.php therefore that is what Brackets is expecting to be entered into the Base Url field minus the actual script file name.
Remember the DocumentRoot of localhost is pointing to the folder C:/wamp/www/
So enter
http://localhost/php_proj1/
into the dialog that requests the Base Url.
Assuming you are editing the file php1.php at the time you clicked the Live Preview icon that is the script that will be run in the browser.
Oh and of course you have to have WAMPServer and therefore Apache up and running when you do this as it is running the code through Apache so that the PHP code can be interpreted.
Found my mistake. I did not do File->Open Folder to open the folder that I was working on...
Try the same thing but with a simple HTML file.
Try launching your project with PHP's built-in server. Open a terminal/cmd window and go to the folder php_proj1. Now execute php -S localhost:8000. Now set your Live preview path to http://localhost:8000/. If this one does work, then there may be a problem with Wamp.
Now remember that no matter what, you're not supposed to contain a file in the Live Preview path, but only a folder path. When you contain it, you get to this URL: http://server/file.php/file.php (double) and that's not exactly what you want...
If none of these work - there may be a problem with either your computer, Brackets, Chrome, or both. Try to reinstall them (Brackets first).
My two cents, is the name of the project php_proj1 ? If not you'll have to use http://localhost/ as your base URL.
Also (When you are using Brackets) check the content of the Chrome Network tab. F12 Developer Tools -> Network -> Filter -> Documents
Try to investigate the URLs, probably that'll give you some insight

opencart corrupted menu in xampp

I copied my files for opencart store from my host and the db to work localy using xampp, but iam experiencing a little problem, the menu in the front end is broken it doesn't look structured.
The links works perfectly fine, i did change the config files to point to the correct folder, rewrite_module is on, changed #RewriteBase / so the links works fine.
I did even update opencart to make sure all files is there, but nothing i have tried is working.
Can someone please help me fix this problem? Have tried everything i can think of.
Iam using Opencart 1.5.6.4
you can see on the following image how the menus look bazaargadgets.com/corrupted menus.jpg
The CSS file isn't being loaded properly (or not at all).
Check to see If it does exist and not corrupted. Re-download anyway just to make sure.
If that doesn't solve your problem, look at the http headers to see exactly what's going on (press F12 in your browser to see dev tools - IE, FF & Chrome)
you may switch to default theme first,
if working fine, the image link might be broken of your current theme
check the image link

Replacing PHP file - file doesn't work anymore

I have a weird problem I cannot seem to solve (as a php noob).
I am working on simple php site (no sql involved). Everything was working perfectly till the moment I decided to copy over the files and edit them on another computer. All worked fine on the other computer as well. Then I took the files and copied them to the first computer again. Here came the problem: if I try to open ANY file copied from the second computer, it doesn't show anything, just a blank page. Even if the file was not edited at all on the second computer.
For example my index.php:
1. Copied from comp 1 to comp 2, no edits done
2. Copied from comp 2 to comp 1
3. Opened in the browser -> blank page
What's going on here and how to solve it? Is it some cache that apache is keeping? How to clear it? Both computers with OSX, however the second one was running MAMP, while the first had php/apache/sql set up.
Your permissions need to be set up correctly. Do the following:
Change the owner of the group to your user
chmod 0755 all the directories
chmod 0644 all the files
Then you are good to go!
You need to make sure that your permissions are set up correctly.
Apache Permissions
The blank page is displaying because Apache is encountering a PHP error somewhere, but is not set to display PHP errors.
Check out what is going on in your Apache error log and work from there. You could also look in the Developer Tools of a browser like Chrome, or use Firebug, to see what response your browser is getting from the server (most likely a HTTP 500 error).
I wouldn't recommend blindly changing ownership on files and directories until you know what is going on.

Facing 404 while accessing a php file

After doing some changes to my plugin amtyThumb, I realized that there is some problem to access imgsize.php. But i dint change anything in imgsize.php.
If i put this script into some other folder other than plugin folder on my site, then everything is working fine. I am keeping file permission 644 on both places. Folder permission is 755 on both places. It is working fine if i run it locally on my PC.
I had checked .htaccess for hotlinking. But it is not enable.
visit article-stack to view the problem. If you open page in IE or chrome, you can see broken image sign or cross sign in place of images which should be appear just before the post title in sidebar.
In addition, I am using previous version of this plugin on my one of the sites where it is working fine. visit thinkzarahatke. All images in footer bar and sidebar, are being displayed through amtyThumb 1.0.
For debugging : I added some code to write to a text file (just to check). But even that code is not getting executed :(
After a long time i found the silly mistake i did. I actually was calling script resides in "amtyThumb" but the actual plugin url was having "amtythumb".

Categories