Jump to content

Php Pages Not Assembling. Please Help.


Cocori

Recommended Posts

Hi.

Firstly, I am a complete novice. If you can help me you will make a despairing woman very relieved and eternally grateful.

 

My website and its database perform perfectly when hosted online by my web host, so I know everything works. I have currently removed my site from their servers and need to do some work on it offline, on my own PC (running Windows Vista Home Premium) before uploading it again. I should mention that it is NOT a Wordpress site.

 

I have installed XAMPP 1.8.0, put all my site files in its htdocs folder, created a the database and installed my .sql file and the database works fine; I can access it via phpMyAdmin. Apache and MySql start without problem.

 

However, I need to know how to get my site's php files to display properly as web pages, just as they do when the site is uploaded and online. I really don't know what I am doing and think I am overlooking something basic.

 

If I go to localhost/index.php, to open my site;s home page, all that shows in the browser is the actual code typed on the index.php file. The same goes for all the php pages. The page does not get assembled into its web page, it just displays all the code. I also tried using c:/xampp/htdocs/index.php but that gives the same result.

 

I created a test php file, with just an html line and a php line but only the html line displays. There is nothing displayed where the php line should be (not even the php code this time).

 

What am I overlooking? Probably something very basic but I am an absolute novice, so haven't a clue. I know very little about php or MySQL and even less about xampp.

When my site was created some years ago, I could access it all offline using xampp but I can't remember how and the person who helped me then is now unavailable to remind me.

 

Can anyone tell me, in the simplest terms, what I should be doing to make my site's php pages display properly, please?

 

Regards

Cocori

Link to comment
Share on other sites

Show us the opening <?php tag you are using in your code.

 

I'll bet they are the lazy-way and time wasting short opening tag <?, which aren't enabled by default and shouldn't be used. By using the full opening <?php tag, your php code will ALWAYS be seen as being php code.

Link to comment
Share on other sites

Hi.

Opening tag in my php files is <?php

 

I notice that in the php test file that comes with xampp, already in the htdocs folder, they use only <?, however, in my own test file, like in all my other files, I used the full <?php

 

None of the php files display as they should, not my site ones, my test one nor xampp's own test.php file.

 

Regards,

Cocori

Edited by Cocori
Link to comment
Share on other sites

Aha.

I have just discovered something, it fixes one problem but shows up another.

 

If I open the php files in Firefox, they work (sort of), if I open them in Chrome, they don't. I have no idea why.

 

However, now that the index.php file opens, it displays an error stating...

you have an error in your SQL syntax. Check the manual that corresponds to your MySQL server for the right syntax to use near " at line 3

 

I'll have to get back to it later today and see if I can work it out, though I think I will be completely lost again. I have no manual for xampp and can find none, though xampp tends to assume some knowledge in its users, so possibly wouldn't help.

 

Regards,

Cocori

Link to comment
Share on other sites

Since phpmyadmin works, which is just a php script, the next most likely problem is a permission issue with the htdocs folder or there's something specifically disabling the php language for that folder.

 

What exactly is the URL in your browser's address bar when you use phpmyadmin on your system? Is there a .htaccess file in your htdocs folder and if so, please post the content of it.

 

Since you got a php runtime error message from your script, php is working. You likely had cached pages in your two different browsers from when you opened the .php file directly and not through the web server.

Edited by PFMaBiSmAd
Link to comment
Share on other sites

Thank you.

 

I hadn't even considered the problem being my browser until just now. I suddenly thought that it was the one thing I hadn't tried, so tried another and voila, well, voila as far as php was concerned, not quite as far as getting it all to work was.

 

If I cannot work out how to solve the "you have an error in your SQL syntax" notification that it has now thrown up, can I come back here later and seek help? Would this be the right place for help with that?

 

 

Regards,

Cocori

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.