Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Newcomer to PHP and MySQL – Help!

Status
Not open for further replies.

Hap007

MIS
Mar 21, 2003
1,018
US
Hi,

I need some advice.

Although I have worked many years in IT, I have only minimal experience in write web applications.
To this point, my exposure has been using FrontPage to develop an informational web site.

So, when it came time to write a new site, I decided to hire an experienced firm to write a new web site for me.

The site is done and looks good.

I am now hoping to use the new site as a teaching tool to help me at least understand how to program in PHP.

The site is developed in PHP and uses MySQL. All works good.

I made a copy on a local Windows XP system.

I got a copy of WampServer, and installed it on the local PC.

Here is where the problems come in:

Seems when I run on my local box, graphics do not display.

Also seems that only the first page displays partially and then just ‘HTML’ code displays afterwards.

So, here are a couple of questions:
1) Any idea what settings are wrong (on my local system), since the pages do not display correctly on my local copy?
2) What tools(interface) should I use to edit/view the PHP code?
3) Can anyone recommend what my next steps should be?

Thanks,
Hap…

Access Developer [pc] Access based Accounting Solutions - with free source code
Access Consultants forum
 
1) Any idea what settings are wrong (on my local system), since the pages do not display correctly on my local copy?
2) What tools(interface) should I use to edit/view the PHP code?
3) Can anyone recommend what my next steps should be?

1. The first thing would be how are you attempting to open the pages locally? just by double clicking the file, or are you actually using the WAMP server. And by that I mean accessing the files as:


2. Any text editor will do, even notepad, which is what I use. However there are many text editors out there.

3. Find an online tutorial or book about PHP, I would also recommend taking a stroll around php.net and taking a look at their online manual. it has plenty of examples and help on PHP functions and tools.

----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
You need to find the differences between the production setup and your local setup. I suggest running
Code:
<?php
phpinfo();
?>
on both computers, then adjusting your local copy to match the production setup. If things still aren't working right, view the apache error log (or wherever your php errors are being logged) and deal with the issues one by one. I use a plain old text editor for php most of the time. Sometimes I'll use dreamweaver or a plugin for eclipse. If you continue to have issues, I suggest posting each issue individually.

-----------------------------------------
I cannot be bought. Find leasing information at
 
While I have used notepad to work with PHP, I like context sensitive highlighting and a lot of the other features you can find in a more full-featured editor. On Windows I use Active State's Komodo editor. It's a free download from their site. Chami's HTML-Kit also works pretty well but it doesn't have as much stuff.
 
Interesting, just to clarify ?
The only page you can see at all is the first page. What is the first page ? is itr any page you chosse just as long as it is the first one ? You also say the first page only display a bit then you see html. So do you actually get some stuff that looks like a proper web page and then some html code ?, sounds like a syntax error is confusing the php interpretor. I know some tools like microsoft web expression put a unicode marker at the start of the .php file which confuses the interpretor.
Then you say graphics don't display. Do you mean images i.e. x.jpg or x.gif files. do you get a box with an x in it where the images should be ?, in which case it looks like the image files are not in the correct location in the web site tree.
Have you tried creating a small php sample to test out the server. for example in the root direcrtory of the web server create a file called fred.php as follows:
Code:
<?php
echo "<img src=x.jpg>";
?>
and put an file called x.jpg in the root directory as well.
Make sure you transfer any .jpg as binary files.
Now just call it in the browser e.g. finally do your images open in standrd tools that come with windows e.g. use file explorer and double click on an image name.
Hope this all helps !
 
I have a couple of question for OP
1) Where is WAMP installed?
2) Is WAMP running?
3) Where did you copied your PHP Site to?
4) Is there something that looks like 1/2 a clock on your systray?

Assuming that you installed WAMP on C:\wamp, it will be a lot easier if you copied your site(s) within c:\wamp\ making it possible to simply use on your browser. If you use a directory outside c:\wamp\www, you will then need to modify your Apache configuration file(s) for this to work.

Also, one critical thing is to make sure that if your code uses short tags (<? instead of <?PHP), you enable this in WAMP/PHP/PHP Settings/[make sure that Open short tag] is checked.

If the 1/2 clock icon on your systray shows a yellow or red shade of any size, it means that one or more of your services are not running; this could be Apache or MySQL or PHP itself, in such case, you will need to fix this before you can have your site up and running.



--
SouthBeach
The good thing about not knowing is the opportunity to learn - Yours truly, 2008.
 
Hi All,

Thanks for the pointers.

I will begin trying each of the suggestions that you have indicated. Being new, this may take a little time.

One of the problems is my live host, 'IPower' seems to shield the user from the PHP.INI file and uses an editor to modify, where on my local system, it is just a file.

WampServer is installed to C:\wamp folder
My code is located in c:\wamp\Yes, wamp is installed and running, no half clock in the tray.

It seems like basic PHP commands work, but the site itself that has many included modules is not, so this is where I need to begin.

Thanks,
Hap...

Access Developer [pc] Access based Accounting Solutions - with free source code
Access Consultants forum
 
I'm surprised no errors are being thrown.

I would suggest you check your php.ini file for the display_errors directive and set that to On
And then look for the "error_reporting" and set that to E_ALL



I would then check that all the included files are where they are meant to be.

Check the PHP scripts for includes and look at the path's to the files, this should tell you whether they are expected to be somewhere else.



----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
often you can upload a php.ini file to a remote directory and scripts that are executed in that directory will inherit the settings within that php.ini file. similarly you can do much the same with local .htaccess files.


 
Since OP mentioned that he is using CMS, I am guessing that there is a PHP script responsible for identifying all of the directories so that needed scripts are called accordingly.

Say if you are using $_SERVER['DOCUMENT_ROOT'], this means based on your reply above, c:\wamp\ c:\wamp\ ... I would recommend posting the PHP code for your initial page (provided it does not openly reveal sensitive stuff) so that once may better assist you with potential causes to your problem.



--
SouthBeach
The good thing about not knowing is the opportunity to learn - Yours truly, 2008.
 
Another option you have, since you already have a live production server, is to copy your working web directory and working database into a subdirectory and a new database and go from there. just make sure not to destroy your old one lol.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top