Use
__DIR__
to get the current path of the script and this should fix your problem.
So:
require_once(__DIR__.'/../class/user.php');
This will prevent cases where you can run a PHP script from a different folder and therefore the relatives paths will not work.
Edit: slash problem fixed
More Related Contents:
- “Notice: Undefined variable”, “Notice: Undefined index”, “Warning: Undefined array key”, and “Notice: Undefined offset” using PHP
- Showing all errors and warnings [duplicate]
- How do I catch a PHP fatal (`E_ERROR`) error?
- Difference between require, include, require_once and include_once?
- Illegal string offset Warning PHP
- PHP Fatal error: Using $this when not in object context
- How can I handle the warning of file_get_contents() function in PHP?
- Reference – What does this error mean in PHP?
- PHP : Custom error handler – handling parse & fatal errors
- PHP Fatal error: Cannot redeclare class
- Disable warnings when loading non-well-formed HTML by DomDocument (PHP)
- Why is require_once so bad to use?
- Fatal error: Class ‘SoapClient’ not found
- Headers and client library minor version mismatch
- How to catch the fatal error: Maximum execution time of 30 seconds exceeded in PHP
- mysql_num_rows(): supplied argument is not a valid MySQL result resource [duplicate]
- Fatal error: Using $this when not in object context
- Handle fatal errors in PHP using register_shutdown_function()
- PHP Warning Permission denied (13) on session_start() [duplicate]
- Why, Fatal error: Class ‘PHPUnit_Framework_TestCase’ not found in …?
- PHP Fatal error: Cannot access empty property
- PHP error: php_network_getaddresses: getaddrinfo failed: (while getting information from other site.)
- Fatal error: Declaration of .. must be compatible with .. PHP
- WordPress Fatal error: Uncaught Error: Call to undefined function mysql_connect() in /wp-includes/wp-db.php:1570
- Cannot redeclare function php [duplicate]
- How to fix ‘Creating default object from empty value’ warning in PHP [duplicate]
- Fatal error: Call to undefined method mysqli_stmt::get_result()
- Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 71 bytes)
- set_error_handler() doesn’t work for FATAL error
- Can I detect and handle MySQL Warnings with PHP?