August 6, 2012

Zend Framework: Fatal error on the server

Question by Guilhem Soulas

I’m trying to put a ZF website on the Internet which works well on my local machine (WAMP).

But on the Linux server, only the main page can be properly displayed. For the other pages, I’ve got a fatal error:

Fatal error: Uncaught exception
‘Zend_Controller_Dispatcher_Exception’ with message ‘Invalid
controller specified (error)’ in
/var/www/staging/library/Zend/Controller/Dispatcher/Standard.php:248
Stack trace: #0
/var/www/staging/library/Zend/Controller/Front.php(954):
Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http),
Object(Zend_Controller_Response_Http)) #1
/var/www/staging/library/Zend/Application/Bootstrap/Bootstrap.php(97):
Zend_Controller_Front->dispatch() #2
/var/www/staging/library/Zend/Application.php(366):
Zend_Application_Bootstrap_Bootstrap->run() #3
/var/www/staging/public/index.php(26): Zend_Application->run() #4
{main} Next exception ‘Zend_Controller_Exception’ with message
‘Invalid controller specified (error)#0
/var/www/staging/library/Zend/Controller/Front.php(954):
Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http),
Object(Zend_Contr in
/var/www/staging/library/Zend/Controller/Plugin/Broker.php on line
336.

I activated the URL rewriting. I’m using modules. The index.php and application.ini are very basic, we didn’t custumize it.

I suppose that there is something wrong with the configuration… Thanks.

Answer by Starx

When deploying application from windows platform to Linux, most typical type of error that can be encountered is due to the filename cases. Linux system are very strict about file name and cases.

The error you are encountering is also probably one of these cases. Check the name of ErrorContainer.php and try to match the name you specify in your route and file system.

April 2, 2012

How to connect the 'MSSQL' database in Codeigniter Framework?

Question by Bhavin Rana

How to connect the ‘MSSQL’ database in Codeigniter Framework ?

i m currectly starting an application which is on codeignitor framework and for db i would like to use the mssql.

applicationconfigdatabase.php file settings here.

$active_group = 'default';
$active_record = TRUE;

$db['default']['hostname'] = '#.#.#.27';
$db['default']['username'] = '@@@@@@';
$db['default']['password'] = '@@@@@@@@@';
$db['default']['database'] = '$$$$$$$$$$$$$';
$db['default']['dbdriver'] = 'mssql';
$db['default']['dbprefix'] = '';
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = '';
$db['default']['char_set'] = 'utf8';
$db['default']['dbcollat'] = 'utf8_general_ci';
$db['default']['swap_pre'] = '';
$db['default']['autoinit'] = TRUE;
$db['default']['stricton'] = FALSE;

after changing the ‘libraries’ in to autoload.php in config folder
it shows just a black white page only with no any of errors.
can you please tell me what other changes i have to do to work with the MSSQL Database ?

#autoload.php#

$autoload['libraries'] = array('database');

Many Thanks in Advance !
😀

Answer by Starx

Your Configuration code is fine. Further reading here

IF you believe the errors are not showing up, then go to the index.php and on the top place the following snippet to show the errors.

error_reporting(E_ALL);

Other, then this check if the MSSQL service is running and is accessible. May be create a simple .php and try a connection with plain codes.

A non CI file Something like,

<?php
$server = 'YOURPCSQLEXPRESS';
$link = mssql_connect($server, 'user', 'pass');

if (!$link) {
    die('Something went wrong while connecting to MSSQL');
}
?>
December 19, 2010

When uploading, where do I set the php.ini parameters?

Question by gAMBOOKa

In the script where the upload form is, or the script that processes the action?

Example parameters:

memory_limit

EDIT: Ok, let me clarify. First, I didn’t know the 2nd, 3rd and 4th parameter could not be changed using ini_set(). Now, I want to know where exactly I should call the ini_set() function. In the form script or the action handling script?

Here’s an example to illustrate what I’m looking for:

form.php

<form action="post.php">
  <input type="text" name="search" />
  <input type="submit" />
</form>

post.php

<?php //handle search ?>

So under which file must my ini_set() function should go?

Answer by Starx

You have to set these parameters initially from php.ini. You cannot change this from a PHP script except memory_limit, for the remaining Just search for those keys you mentioned in php.ini and change their values.

For memory_limit you can use following snippet at your processing page handling the uploads like in your case at post.php

ini_set("memory_limit","16M");

OR

You can create a .htaccess file at the root directory, if your server support mod_rewrite modules you can change them like this

php_value upload_max_filesize 20M
php_value post_max_size 20M
php_value max_execution_time 200
php_value max_input_time 200
...

Please fill the form - I will response as fast as I can!