[ubuntu-za] LAMP install

Bruce Pieterse dev at otq.za.net
Sat Oct 20 11:41:09 UTC 2012


On Sat 20 Oct 2012 11:06:24 SAST, Alf Stockton wrote:
> I have followed the procedure at
> http://community.linuxmint.com/tutorial/view/486 to install LAMP on my
> Mint 13 laptop with a view to developing locally & once working
> emigrate to my server but ......
> Displaying html & php in Firefox works fine but links seem to be failing.
> The following extract from one of my proggies works fine from the
> command line but not when called from a link in the browser. I suspect
> the problem may have something to do with the
> require_once('includes/configuration.inc');
> but what?
>
> <?php
> require_once('includes/configuration.inc');     // database connect
> script & the rest.
> ?>
> <!DOCTYPE html>
> <html>
> <head>
> <title>Insert a new User</title>
> <meta http-equiv="cache-control" content="no-cache">
> <meta http-equiv="expires" content="Mon, 22 Jul 2000 11:12:01 GMT"
>
> </head>
> <?php
>     DBConnect();
>     $Message = sprintf("<br />Line %d After DBConnect()<br />",
> __LINE__);
>     trigger_error($Message, E_USER_ERROR);
>
>     if (!get_magic_quotes_gpc())
>         {
>         $_POST['uname'] = addslashes($_POST['uname']);
>         }
>     $name_check = "SELECT Usrname FROM Users WHERE Usrname =
> '".$_POST['uname']."'";
>     $Result = mysql_query($name_check);
>     $Count = 0;
>     while ($row = mysql_fetch_array($Result))
>         {
>         ++$Count;
>         }
>
>     if ($count != 0)
>         {
>         $Message = sprintf("%s %d <br>Sorry, the username: %s is
> already taken, please pick another.", __FILE__, __LINE__);
>         trigger_error($Message, E_USER_ERROR);
>         exit;
>         }
>
>     $Message = sprintf("<br />Line %d After username check<br />",
> __LINE__);
>     trigger_error($Message, E_USER_ERROR);
>     if ($_POST['passwd'] != $_POST['passwd_again'])
>         {
>         $Message = sprintf("%s %s %s %s<br
> />",strip_tags($_POST['Surname']),strip_tags($_POST['FirstName']),
> strip_tags($_POST['uname']),strip_tags($_POST['passwd']));
>         trigger_error($Message, E_USER_ERROR);
>         $Message = sprintf("%s %d %s %s<br>Passwords did not match!<br
> />",__FILE__, __LINE__,$_POST['passwd'],$_POST['passwd_again']);
>         trigger_error($Message, E_USER_ERROR);
>         exit;
>         }
>
> etc etc etc
>

Hi Alf,

If you append .php to the end of the file name it should work. So 
require_once('includes/configuration.inc'); would become require_once 
'includes/configuration.inc.php';

The parenthesis’s for require_once is not required as require_once is 
not a function, but a statement.

If the above still doesn't work, we need to look at your apache config.

--
All the best,

Bruce

FSF Member 10674 / The FSF is a charity with a worldwide mission to 
advance software freedom / Join the Free Software Foundation: 
http://www.fsf.org/register_form?referrer=10674




More information about the ubuntu-za mailing list