Migrating magento to new server causes incomplete templates - php

I'm working locally on a Magento install, when I try to upload the sources to the production server it starts happening something very frustrating: the homepage output is not complete, I only see a section of the page instead of seeing the whole page.
I zipped the local copy and transferred using scp so I don't think it can be some missing file, the only thing I updated was the media directory, but from what I know it has to do with media assets, not with templates... I uploaded the source several times, and nothing...
Also the DB is the same copy, so it cannot be an issue.
The output HTML is different (and for instance it's also missing the closing body and html tags.
What can be wrong?

Try this:
http://www.magentocommerce.com/_media/magento-check.zip
http://www.magentocommerce.com/system-requirements
Since the only difference is the server you need to make sure it has all those pre-requisites checked.

Related

PHP can't file contact.html, but it shouldn't exist? (Smarty Engine)

I've got a legacy PHP project to fix a thing or two. I've downloaded it via FileZilla and served it on my local machine with a local copy of the database. The project is exactly the same with the live one, yet the live one can open the url/contact.html but on my machine it says no such file is found. All other pages go for url/categories/ or url/products/ so I've tried altering the url but no use.
All the other pages within the site are simple: one .php controller one .php model and one .tpl smarty template view. Requiring no .html at all. But this one is somehow different. The .htaccess file is exactly the same as the live version. I've tried adding a rewrite rule to direct every .html to .php but didn't work. I'm lost and out of options, please help? It doesn't even have to be an answer,"Try looking into that" would work too.
I'm working via XAMPP on windows, and I've configured the https:// to http:// on my project but that's all. Even hidden files are checked and confirmed.
have checked that contact.html is a static file (like a real existing html file?)
is there some kind of "routing" within the PHP of the project? If there is route urls might be really anyware.. in the mysql database, redis, a json file and whatnot.. have seen them all.
try to debug where and how it works on the "production" server by using some logging to a file edit the file through filezilla and log to a 'mylog.log' file until you find out what is going on.. or if the site is not used all the time by clients - you can just try to echo stuff to figure out how this exact /contact.html works

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

PHP files will not stop opening locally

I am not sure what is going on here but I was working on configuring my apache server today but after a load of hassle gave up and just installed MAMP instead. Problem is that now when I open a local php file as soon as it opens another one opens until I close Firefox. When I open the file with Chrome all that is displayed is code? A page is fine until I change the extension from .html to .php
It makes no difference where the file is located (ie local host or desktop).
Has anyone else had this problem? I suspect it may be something to do with installing apache manually and then MAMP? Something must have gone wrong along the way.
Perhaps it is possible to completely uninstall apache and start again, but I have no idea how to do this!
Thank you for any help,
Margate
Doubling clicking PHP files in a File Explorer type thing or opening from the file system with the Open dialog of a browser will open them as regular HTML or Text (depending on the browser). To get them to work as PHP you have to go as if to a webpage, since PHP code is interpreted by the webserver not the browser. I.e. http://localhost/somefile.php
And make sure links to PHP pages in your site are relative links. I.e. <a href='/somefile.php'>Somefile</a> and not file system links, i.e. <a href='file:///c:\webroot\somefile.php'>Somefile</a>. PHP has to go through the server. The same goes for HTML files too. If you serve filesystem links, the links will not work for anyone else anyway.

php code displaying on web page instead of working behind the scene

I have an index.html in my wampserver www directory. On this html, there is a link for a user to upload file. When I hit the link, I select files to upload but instead of the uploadmanager.php which i have tested in my eclipse debugg environment to work, it displays the some part of the code on the web page without doing anything thing. This is not what I expect. Can someone please tell me what is wrong? Thank you.
sound like you are using php-short-open-tags (<? instead of <?php) without enabling this in your php.ini. change your php.ini or use the standart open-tags to solve this.
Are you sure you enabled PHP in WAMP?
Try creating a new uploadmanager.php file directly in wamp/www (or whatever subdirectory) and paste the code from your tested uploadmanager script into the new file. Then try to run it in WAMP.
I think it is a permissions problem. I copied an index.php file into a c:/wamp/www/subdirectory and it only displayed the code. Once I created a new index.php file and pasted the contents of the old file into it, it worked perfectly.
Are you posting to the uploadmanager.php page? Are you getting an error or just seeing the code? Can you post the code from the index.html page that handled the form and the part of the php code you're seeing for us to look at?
Every now and then I have Apache serving the .php as downloadable files instead processing them on the server, but only with random requests.
Some reasons, why this might happen, are
PHP misconfiguration
PHP-files in a directory without execute rights
wrong content type sent
timeout from script execution
In my situation the last bullet is the most dangerous, but luckily it seems to show up only immediately after modifying some of the .php files. I haven't tracked the problem any deeper yet, but it seems to relate some filesystem level operations (as the disk I/O is a bottleneck) and presents itself only in testing env.

Categories