Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7431479
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T09:18:08+00:00 2026-05-29T09:18:08+00:00

I have this code to create a config.ini file with Zend Framework but I

  • 0

I have this code to create a config.ini file with Zend Framework but I always get a Internal Server Error (Error 500) from the webpage…

<?php
session_start();

$config = new Zend_Config_Ini('config.ini',null,array('skipExtends' => true, 'allowModifications' => true));

// CREATE VALUE
$config->database = array();
$config->base = array();
$config->system = array();
$config->home = array();
$config->other = array();

    //DATABASE
    $config->database->hostname = $_SESSION['db_hostname'];
    $config->database->username = $_SESSION['db_username'];
    $config->database->password = $_SESSION['db_password'];
    $config->database->port = $_SESSION['db_port'];
    $config->database->database = $_SESSION['db_name'];
    // BASE
    $config->base->base_url = $_SESSION['base_url'];
    $config->base->site_name = $_SESSION['site_name'];
    $config->base->site_slogan = $_SESSION['site_slogan'];
    // SYSTEM
    $config->system->license = 'false';
    $config->system->cms_type = 'free';
    $config->system->system_email = $_SESSION['system_email'];
    // HOME
    $config->home->homepage_type = 'welcome';
    $config->home->blog_limit = 10;
    $config->home->homepage_message = 'Welcome to CustomCMS!';
    // OTHER
    $config->other->copyright_text = 'Copyright &169; 2012 FMarcoux - All rights reserved';

// Write the config file
$writer = new Zend_Config_Writer_Ini(array('config' => $config,'filename' => 'config.ini'));
$writer->write();

// NOW EXECUTE SQL FILE
$sqlErrorText = '';
$sqlErrorCode = 0;
$sqlStmt = '';
$sqlFileToExecute = 'install_query.sql';

$con = mysql_connect($_SESSION['db_hostname'].':'.$_SESSION['db_port'],$_SESSION['db_username'],$_SESSION['db_password']) or die(mysql_error());
mysql_select_db($_SESSION['db_name'], $con) or die();

if ($con)
{
   // Load and explode the sql file
   $f = fopen($sqlFileToExecute,"r+");
   $sqlFile = fread($f,filesize($sqlFileToExecute));
   $sqlArray = explode(';',$sqlFile);

   //Process the sql file by statements
   foreach ($sqlArray as $stmt)
   {
      if (strlen($stmt) > 3)
      {
         $result = mysql_query($stmt);
         if (!$result)
         {
            $sqlErrorCode = mysql_errno();
            $sqlErrorText = mysql_error();
            $sqlStmt      = $stmt;
            break;
         }
      }
   }
   mysql_query("INSERT INTO `users` (`id`, `username`, `password`, `role`, `full_name`, `email`, `avatar`, `avatar_type`, `ip`, `comments`, `bio`, `privacy_level`, `location`, `banned`, `user_slogan`) VALUES (1, 'admin', '".md5($_SESSION['admin_password']."', 3, 'admin', '".$_SESSION['admin_email']."', '', 'none', '127.0.0.1', 0, '', 3, '', 0, '');") or die(mysql_error());
}
if ($sqlErrorCode == 0)
{
    echo "<tr><td>Installation was finished succesfully!</td></tr>";
    header('Location: done.php');
} 
else
{
include('header.php');
?>
<div id="main">
    <h1>Writing File...</h1>
    <hr />
    <?php
    echo "<tr><td>An error occured during installation!</td></tr>";
    echo "<tr><td>Error code: ".$sqlErrorCode."</td></tr>";
    echo "<tr><td>Error text: ".$sqlErrorText."</td></tr>";
    echo "<tr><td>Statement:<br/> ".$sqlStmt."</td></tr>";
    ?>
</div>
<div id="sidebar">
    <ol>
        <li><strike>Welcome</strike></li>
        <li><strike>Database</strike></li>
        <li><strike>Admin</strike></li>
        <li><strike>Basic Configuration</strike></li>
        <li><b>Create 'config.ini'</b></li>
        <li>Done</li>
    </ol>
</div>
<div id="footer"></div>

Sorry for the long code!

If someone can help me with this issue, it would be appreciate!

NOTE: All of my $_SESSION[] are setted.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T09:18:10+00:00Added an answer on May 29, 2026 at 9:18 am

    The two problems I see are:

    • In the MySQL insert, md5($_SESSION['admin_password']."' needs to be md5($_SESSION['admin_password'])."' You are missing the ) for md5.
    • You have an unclosed if statement at the end of the file. Add <?php } ?> after the footer div.

    You can set your application to production, or turn error reporting on to get a stack trace, or in this case see the PHP syntax error message instead of the 500 Server Error. Also, the error_log file should have the error in it as well.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this code working in C#: var request = (HttpWebRequest)WebRequest.Create(https://x.com/service); request.Method = GET;
I have the this code that will create excel file and work sheet then
I have this code to create an ATOM feed Dim xmlResult As New StringBuilder
I have this code which should create a splash image with either no animation
I have this webdav code thats creating folders in SharePoint: HttpWebRequest request = (System.Net.HttpWebRequest)HttpWebRequest.Create(folderAddress);
I have problem compilin this code..can anyone tell whats wrong with the syntax CREATE
I have a python script the runs this code: strpath = sudo svnadmin create
I'm using PHP5 to create XML files. I have code like this: $doc =
I have created this code, and when I run it, don't get any errors
I have this code to create a configuration of a java client to connect

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.