PHP Classes
elePHPant
Icontem

how to install your 'package'

Recommend this page to a friend!

      PHP Error and Exception Handling class  >  All threads  >  how to install your 'package'  >  (Un) Subscribe thread alerts  
Subject:how to install your 'package'
Summary:i try to test your example but i got : ...
Messages:13
Author:martin
Date:2015-12-26 14:51:10
 

 

  1 - 10   11 - 13  

  1. how to install your 'package'   Reply   Report abuse  
martin - 2015-12-26 14:51:10
I'm sorry but i'm a newbee and I'm very insteresting with your class.
So i unzip all the files to root of my PHP and when I try your example i get this error message :

Fatal error: Class 'Define\Utilities\ErrorExceptionHandler' not found in C:\EasyPHP-DevServer-14.1VC9\data\localweb\example.php on line 4

I suppose that files aren't in good place.

Please, can you help me.

thanks in advence,

martinarthur



  2. Re: how to install your 'package'   Reply   Report abuse  
Nitesh Apte - 2015-12-26 19:27:41 - In reply to message 1 from martin
Hi Martin,

Copy and paste the following in example.php file and let me know the result after executing it.

set_include_path(get_include_path().PATH_SEPARATOR."");

function __autoload($object) {
$split = explode("\\", $object);
$className = end($split);
require_once("{$className}.php");
}

define("DIRECT_ACCESS", TRUE);
use Utilities\ErrorExceptionHandler;

ErrorExceptionHandler::getInstance();
// create some error or exception.

  3. Re: how to install your 'package'   Reply   Report abuse  
martin - 2015-12-26 22:34:01 - In reply to message 2 from Nitesh Apte
First : thank you for your quick answer.

now the result


content of directories where root is c:\EasyPHP-DevServer-14.1VC9\data\localweb :
-----------------

Répertoire de c:\EasyPHP-DevServer-14.1VC9\data\localweb
26/12/2015 23:13 <REP> .
26/12/2015 23:13 <REP> ..
26/12/2015 15:39 <REP> Define
23/12/2015 18:45 1˙142 define.inc
23/12/2015 18:45 615 ErrorCodes.inc
23/12/2015 18:45 11˙326 ErrorExceptionHandler.php
26/12/2015 23:15 340 example.php
23/12/2015 18:45 209 ExceptionCodes.inc
23/12/2015 18:45 1˙094 FrameworkException.php
14/12/2015 11:19 155 index.html
23/12/2015 18:45 1˙101 IUtilities.php
26/12/2015 23:13 2˙788 myerror.php
23/12/2015 18:45 2˙072 SingletonTrait.php



Répertoire de c:\EasyPHP-DevServer-14.1VC9\data\localweb\Define\Utilities

26/12/2015 15:42 <REP> .
26/12/2015 15:42 <REP> ..
23/12/2015 18:45 1˙142 define.inc
23/12/2015 18:45 615 ErrorCodes.inc
26/12/2015 16:25 10˙318 ErrorExceptionHandler.php
23/12/2015 18:45 209 ExceptionCodes.inc
23/12/2015 18:45 1˙094 FrameworkException.php
23/12/2015 18:45 1˙101 IUtilities.php
23/12/2015 18:45 2˙072 SingletonTrait.php



the script example.php :
------------------------

<?php
set_include_path(get_include_path().PATH_SEPARATOR."");

function __autoload($object) {
$split = explode("\\", $object);
$className = end($split);
require_once("{$className}.php");
}

define("DIRECT_ACCESS", TRUE);
use Utilities\ErrorExceptionHandler;

ErrorExceptionHandler::getInstance();
// create some error or exception.
failing();
?>



the result in response of 127.0.0.1/example.php with firefox :
--------------------------

set_include_path(get_include_path().PATH_SEPARATOR.""); function __autoload($object) { $split = explode("\\", $object); $className = end($split); require_once("{$className}.php"); } define("DIRECT_ACCESS", TRUE); use Utilities\ErrorExceptionHandler; ErrorExceptionHandler::getInstance(); // create some error or exception.



  4. Re: how to install your 'package'   Reply   Report abuse  
Nitesh Apte - 2015-12-27 08:16:48 - In reply to message 3 from martin
Hi Martin,

From your response that you got after executing the code, it seems like your server is not recognizing the PHP content/extension or you missed to put the code between php tags.

Copy and paste the content of example.php here that you have in your local server.

N

  5. Re: how to install your 'package'   Reply   Report abuse  
martin - 2015-12-27 21:49:51 - In reply to message 4 from Nitesh Apte
Good evening,
I believe that I would not manage to solve my problem thus.
I ask my question again:

In file ZIP there 8 files :

define.inc,
ErrorCodes.inc,
ErrorExceptionHandler.php,
example.php,
ExceptionCodes.inc,
FrameworkException.php,
IUtilities.php and
SingletonTrait.php.

Where to put all these files?
In the root directory of EasyPHP or then must I create a Define/Utilities tree structure in which I must put all my files except example.PHP?

Once the files placed well I could then test and transmit my results to you.
Thank you for your patience.

  6. Re: how to install your 'package'   Reply   Report abuse  
Nitesh Apte - 2015-12-28 07:02:19 - In reply to message 5 from martin
I got you now.

create a folder and put all the files inside that folder and then put that folder in your root dir.

To test: http://localhost/(folder the you created)/example.php

Use following example.php
<?php
set_include_path(get_include_path().PATH_SEPARATOR."");

function __autoload($object) {
$split = explode("\\", $object);
$className = end($split);
require_once("{$className}.php");
}

define("DIRECT_ACCESS", TRUE);
use Utilities\ErrorExceptionHandler;

ErrorExceptionHandler::getInstance();
// create some error or exception.

?>

  7. Re: how to install your 'package'   Reply   Report abuse  
Nitesh Apte - 2015-12-28 18:46:18 - In reply to message 6 from Nitesh Apte
Hi Martin,

I have updated the package. There was mistake in example.php file. Please download the latest package. Unzip it. Make sure all the files are inside a folder. Put that folder in web root directory.

To test, put this statement in example.php file after the comment (// create some error or exception.)

new Hail();

Try accessing: http://localhost/(foldername)/example.php

A page with error message and other details should be displayed. And it should be like the one in Screenshot of this package.

Now, in order to use it in a project, please have a look at the MVC that I have created. http://www.phpclasses.org/package/9536-PHP-A-Front-Controller-based-PHP-MVC-framework.html

It is not published yet. So, in case you are not able to access it, you can check it here - https://github.com/niteshapte/define-mvc.

Let me know if you have any questions.


Thanks

  8. Re: how to install your 'package'   Reply   Report abuse  
martin - 2015-12-29 15:48:00 - In reply to message 7 from Nitesh Apte
Hi (Nitesh or Apte ?)

Thank you for your help.

I'd install your new version

i'd insert at the end of example.php, like your recommand :

I'd send myphp folder/example.php

and the result is only a line in bold, capital message :

SITE_GENERIC_ERROR_MSG

It don't look like your screenshot.
Something wrong ?

have a nice evening.

  9. Re: how to install your 'package'   Reply   Report abuse  
Nitesh Apte - 2016-01-01 19:04:32 - In reply to message 8 from martin
Hi Martin,

It's Nitesh Apte. Nitesh is firstname and Apte is surname. ;-)

I am sorry, it is not working out for you. Are you using all the latest files. Because I tested everything after updating the package and everything is working as expected.

Let me know.

Nitesh

  10. Re: how to install your 'package'   Reply   Report abuse  
DigiLive - 2016-01-04 08:55:19 - In reply to message 8 from martin
You're correct.

The class constructor of file ExceptionHandler.php is missing a line -> include 'define.inc';

It should be:

protected function __construct() {
include 'define.inc';
$this->errorType = include 'ErrorCodes.inc';
$this->exceptionType = include 'ExceptionCodes.inc';
$this->enableHandler();
}

(unless the creator had something else in mind to include define.inc)

 
  1 - 10   11 - 13