Mysterio75 Posted February 2, 2010 Share Posted February 2, 2010 Hello, Can anyone help with the following please? I have written a mainly HTML site for a charity (a support forum mainly) but have also tried to incorporate a "site search" function using some software called Search Engine Builder. The indexing software seemed to go ok, and it created 3 files which were copied to my webserver: Search.php searchfunc.php webdata.php However (and being a newcomer to PHP) , when I try to link to the Search.php from my homepage, I saw "Internal Server error" when clicking the relevant URL. The contents of search.php are : <HTML><HEAD> <TITLE>Search Engine Builder Professional -- Search this site</TITLE> </HEAD> <BODY> <!-- You can move the following search box code to where you want to display a search box. --> <!-- Don't modify the name of the FORM and INPUT --> <!-- *********************** BEGIN of search box code *********************** --> <FORM name="formSear" action="search.php" method="GET"> <p align="center"> <INPUT name="searWords"> <INPUT name="Send" type="submit" value="Search"> <p align="left"> </FORM> <!-- *********************** END of search box code ************************* --> <!-- You can move the following search results output code to where you want to output search results. --> <!-- Modify the "include()" if needed. For example, modify to include("/search/webdata.php") etc. --> <!-- ******** BEGIN of search results output code ******** --> <?include("webdata.php");?> <?include("searchfunc.php");?> <!-- ******** END of search results output code ********** --> <!-- Ignore the following IFrame line if you will not use IFrame in your search engine --> </BODY> </HTML> I tried renaming the search.php to search.html (and reflected it on my homepage) and it indeed brought the search box up, but then I am stuck as it doesn't seem to trigger any query (or output on the screen) of the data the indexing (seems to have) gathered. What am I "not doing" or missing please? Is there some code I have missed out? I mailed the SW provider - no reply! I really hope this makes sense to someone, I'm doing the site for nothing and it's making me pull my hair out (what is left of it) Thanks, Martin. Link to comment https://forums.phpfreaks.com/topic/190726-simple-urgent-coding-help-please/ Share on other sites More sharing options...
Mysterio75 Posted February 2, 2010 Author Share Posted February 2, 2010 NB - I am not trying to index the forum - just the main part of the site (I realise phpbb has a search function all of it's own) thanks. Link to comment https://forums.phpfreaks.com/topic/190726-simple-urgent-coding-help-please/#findComment-1005799 Share on other sites More sharing options...
teamatomic Posted February 2, 2010 Share Posted February 2, 2010 The first thing I would do is eliminate the short tags and see what happens. The problem could also be within one of the included files. Next, how exactly did the file get to your server? Is the script that creates the files on your remote server? Is it Linux/Unix or Windows? Did you develop the site on your home PC and upload the files. The reason I'm asking is that a 500 error can be caused by improper line endings. Linux/Unix server will not use a file with windows line endings. HTH Teamatomic Link to comment https://forums.phpfreaks.com/topic/190726-simple-urgent-coding-help-please/#findComment-1005804 Share on other sites More sharing options...
Mysterio75 Posted February 2, 2010 Author Share Posted February 2, 2010 Thankyou very much for your help firstly. I have PM'd you the site name. I didn't know whether to call the file I directed my URL to as search.php or search.html - when I called it .php, the internal error appeared. When I renamed it .html, the search box appeared but when I actually did a search it came back with "The link appears to be broken". I get the feeling that I'm not telling the script to run a command, or indeed output the results somewhere - but I could be wrong? My Search.html now looks like this <HTML><HEAD> <TITLE>Search Engine Builder Professional -- Search this site</TITLE> </HEAD> <BODY> <FORM name="formSear" action="search.php" method="GET"> <p align="center"> <INPUT name="searWords"> <INPUT name="Send" type="submit" value="Search"> <p align="left"> </FORM> <?include("webdata.php");?> <?include("searchfunc.php");?> </BODY> </HTML> I FTP'd the files up, the perms were 644, but are now 655 as I thought this may have caused an issue also. No joy. I edited the files on my home pc and uploaded them but I'm not sure what OS my host webserver uses (not sure how to find out) In case you haven't noticed, I'm very "green" !!!! thanks so much again. Martin Link to comment https://forums.phpfreaks.com/topic/190726-simple-urgent-coding-help-please/#findComment-1005808 Share on other sites More sharing options...
Orionsbelter Posted February 2, 2010 Share Posted February 2, 2010 Next time please put your code between tags Link to comment https://forums.phpfreaks.com/topic/190726-simple-urgent-coding-help-please/#findComment-1005811 Share on other sites More sharing options...
teamatomic Posted February 3, 2010 Share Posted February 3, 2010 A 500 error is not caused by syntax. It is caused by the server puking at a deeper level although a bad .htaccess file can throw a 500 thus masking a parallel problem with script syntax. File permissions probably are not a problem unless you went and did a wholesale chmod to 755 or 777. But if you are developing on a linux box and uploading to a linux/unix server the chances increase that it could be permission related. I can, on my home SuSe box do a recursive 777 to home and all will serve happily along. If I pushed a site over to a production serve there would be massive 500 errors as linux to linux preserves the original file permissions whereas windows tol linux the remote serve will set the perms. As I said earlier the line endings can be a cause. Another cause can be a bad .htaccess file. If you want more you need to answer these: How did the files get to the remote server? What OS is the remote? What OS are you developing on. Did you open the files, edit and save on a windows box with a windows centric editor like note or heavens forbid, office/works? Did the search script that created the three files make a .htaccess file? Did you? What are the perms of the three files and their associates folders on the remote server? HTH Teamatomic Link to comment https://forums.phpfreaks.com/topic/190726-simple-urgent-coding-help-please/#findComment-1005816 Share on other sites More sharing options...
RussellReal Posted February 3, 2010 Share Posted February 3, 2010 500 errors are usually caused by htaccess problems, or apache limitations. Link to comment https://forums.phpfreaks.com/topic/190726-simple-urgent-coding-help-please/#findComment-1005819 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.