Have an account? Sign in
Login  Register  Facebook
Script for php search engine
hi i have dowloaded this script as a part of a php search engine, this script insert in a table the meta tags that will be used later to do the research
<?php

echo '<p>n

<table BGCOLOR="#EFF2FB" BORDER="0" CELLSPACING="0" CELLPADDING="1" WIDTH="100%">n 
    <tr><td>
        <a name="#index"><h2>Indexation du site en cours</h2></a>n
    </td></tr>
</table>
<p>';

    $host = "localhost";
    $user = "root";
    $password = "";
    $bdd = "pfe2";

/* Connexion avec MySQL */

mysql_connect($host,$user,$password) or die ("Impossible de se connecter");
mysql_select_db($bdd) or die ("Impossible d'accéder à la base $bdd");


$query = mysql_query("DELETE FROM search");

function ScanDir_all($Directory){

$MyDirectory = opendir($Directory);

    while($Entry = readdir($MyDirectory)) {

        echo "<br>entry= $Entry<br>";

        echo "repertoire= $Directory<br>";

        echo "chemin= $Directory/$Entry<br>";

        if(is_dir($Entry)&& $Entry != "." && $Entry != "..") {

            echo "<b><font color='red'>$Entry</font>

                  </b> est un repertoire<br>";

            ScanDir_all("$Entry/$Directory");

        }

        else {

        if (eregi(".htm",$Entry)) {

            $MetaTags = get_meta_tags($Directory."/".$Entry);

            if ($MetaTags["robots"] == "all") {

                $MetaKey = $MetaTags["keywords"];

                $MetaKey = strtoupper($MetaKey);

                echo "Meta($Directory/$Entry): $MetaKeyn";

                $MetaTitre = $MetaTags["title"];


                echo "Meta($Directory/$Entry): $MetaTitren";


            $query = "INSERT INTO search (lien,keyword,titre) VALUES('$Directory/$Entry','$MetaKey','$MetaTitre')";

            $mysql_result = mysql_query($query) or die ("Erreur de modification");

            }

        }

        }

    }
closedir($MyDirectory);

}



$open_basedir=".";

ScanDir_all(".");

mysql_close();

?>
The problem is that everytime i run it Apache crashes ? any idea on the why ? And if not could recommand me a simple and proven solution for a small site ?
Started: September 18, 2011 Latest Activity: September 18, 2011 php apache
1 Answer
do you mean a sytax error?
please let me see the error text but first try the code in your question agian because i made some edits

Posted: MacOS
In: September 18, 2011

the messages are in french so i am going to translate them. When i run the script through wamp, it first wait a little time and then immediatly after a windows pop up box appears saying that apache http server has ceased to exist and that it has been stopped, firefox says that with the server has been reinitialised during the loading.
September 18, 2011

see, i think the error not from the php code and i think too there is no any relation ship between that code and search tags
September 18, 2011

Your Answer

xDo you want to answer this question? Please login or create an account to post your answer