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
Related Contents:
- "Notice: Undefined variable", "Notice: Undefined index", "Warning: Undefined array key", and "Notice: Undefined offset" using PHP
- Reference – What does this error mean in PHP?
- 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
- Showing all errors and warnings [duplicate]
- How can I handle the warning of file_get_contents() function in PHP?
- PHP : Custom error handler – handling parse & fatal errors
- Weird PHP error: ‘Can’t use function return value in write context’
- Why is require_once so bad to use?
- PHP Fatal error: Cannot redeclare class
- Disable warnings when loading non-well-formed HTML by DomDocument (PHP)
- Headers and client library minor version mismatch
- Fatal error: Class ‘SoapClient’ not found
- Remove warning messages in PHP
- PHP Fatal error: Cannot access empty property
- How to catch the fatal error: Maximum execution time of 30 seconds exceeded in PHP
- Warning: session_start() failed: No such file or directory
- mysql_num_rows(): supplied argument is not a valid MySQL result resource [duplicate]
- Fatal error: Using $this when not in object context
- How can I catch a “catchable fatal error” on PHP type hinting?
- PHP Warning Permission denied (13) on session_start() [duplicate]
- PHP error: php_network_getaddresses: getaddrinfo failed: (while getting information from other site.)
- Handle fatal errors in PHP using register_shutdown_function()
- Why, Fatal error: Class ‘PHPUnit_Framework_TestCase’ not found in …?
- Fatal error: Uncaught Error: Cannot use a scalar as an array warning
- require_once :failed to open stream: no such file or directory
- Server configuration by allow_url_fopen=0 in
- Cannot redeclare function php [duplicate]
- When should I use MySQLi instead of MySQL?
- How to catch cURL errors in PHP
- Preserve Line Breaks From TextArea
- Login to remote site with PHP cURL
- Generating a random password in php
- MySQLi query returns only one row
- PHP: Warning: sort() expects parameter 1 to be array, resource given
- imagecreatefrompng() Makes a black background instead of transparent?
- PHP Redirect to another page after form submit
- PHP buffer ob_flush() vs. flush()
- How do I escape only single quotes?
- Any decent PHP parser written in PHP? [closed]
- Laravel-5 ‘LIKE’ equivalent (Eloquent)
- Why does the Laravel API return a 419 status code on POST and PUT methods?
- PHP Adding 15 minutes to Time value
- How do I check if a directory exists? “is_dir”, “file_exists” or both?
- Selecting a float in MySQL
- sending push notifications to multiple android devices using GCM
- Single Result From SUM With MySQLi
- explain $CI =& get_instance();