Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 7 years ago.
Improve this question
I am getting this error. Cant seem to find what the problem is:
Notice: Use of undefined constant DIR - assumed 'DIR' in C:\wamp\www\Authentication\app\start.php on line 7
How can I get rid of this error?
Here is the code:
<?php
session_cache_limiter(false);
session_start();
define('INC_ROOT', dirname(_DIR_));
echo INC_ROOT;
?>
I also tried dirname(_FILE_) and it still doesn't work. I'm using php 5.5.12
"i had two underscores - one at each side"
As per the manual
http://php.net/manual/en/language.constants.predefined.php
The magic constants require 2X underscores on both sides.
__DIR__
__FILE__
Related
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 5 years ago.
Improve this question
I am using laravel 5.3 to build an a page but after specifying a route and using it in a browser, the following error appears
"Use of undefined constant strah - assumed 'strah' (View: C:\wamp64\www\admin\resources\views\strah\layout.blade.php)".
I have created a layout.blade.php file and has the following line which i think is the root cause
#include(strah.header.header)
Do I have any wrong syntax?
What can I do to get it running?
Route::get('/dashboard',function() {
return view('strah.layout');
});
You have to enclose the include value within quotes. Try :
#include('strah.header.header')
Change
#include(strah.header.header)
to
#include("strah.header.header")
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
gettng the below even though the file is quotes is the file I am using and the line is the exact line of the actual function declaration ?
Fatal error: Cannot redeclare sortByTest() (previously declared in ."file"... line .."123"
It just means you're including that file twice. The first time it is included, everything is fine. The next time it is included, PHP goes through the file again, gets to the "function sortByTest(...)" declaration and it goes BOOM because it already had the function defined in memory.
To solve this, change the part where you're including the file to one of:
include_once "..."
or
require_once "..."
I recommend require_once if it is not a view template file.
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
I'm trying to use this code but it gives me an error :
// root path defined("ROOT_PATH")
|| define("ROOT_PATH", realpath(dirname(__ FILE__) . DS."..".DS));
this is the error:
Parse error: syntax error, unexpected 'FILE__' (T_STRING) in /opt/lampp/htdocs/op/inc/config.php on line 20
You have an extra space in __ FILE__ , It should be __FILE__.
Not sure if you did that just for formatting here.
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
How come this php script is returning a parse error?
When I remove the line that assigns argv to a variable, PHP won't return a parse error. Furthermore, it says the parse error is on the print line.
<?php
$points = $argv[1]
print($argv[1])
?>
PHP statements should end with ;
$points = $argv[1];
^
print($argv[1]);
^
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
I've been using session_start() fine with my other PHP files. Now however, I am trying to put functions into one file and then be able to call them from various other PHP files.
I simply have this in one file:
<?php require("CustomerFunctions.php");
start_session();
PrintCustomerTable();
?>
However I am getting Fatal error: Call to undefined function start_session()
Again, I am able to use start_session everywhere else in my files but now for some reason it won't work in this file. It has the same result even if I remove the require.
The function you're looking for is called session_start().