PHP Error - BASE_URL - username - CodeIgniter
up vote
0
down vote
favorite
A while ago I attempted to re-open previous work but could not get the XAMPP Control Panel to open, I guess because I re-installed Windows 10. I then decided to download the latest versions of XAMPP & CodeIgniter and then transfer my previous files to the new system.
Previous CI_VERSION = '3.1.1' - Latest CI_VERSION = '3.1.9' - Previous PHP version: 7.0.8 - Latest PHP version 7.2.3
When my current system directs to the "username" page which is where the username & password are created, I get the following error. This function was working OK in my previous system. It appears to be caused by a difference between the versions of PHP.
A PHP Error was encountered
Severity: Warning
Message: Use of undefined constant BASE_URL - assumed 'BASE_URL' (this will throw an Error in a future version of PHP)
Filename: username.php
Line Number: 47
This is Line 47
<form class="form" method="post" action="<?php echo BASE_URL . 'username'; ?>">
Backtrace:
File: C:xampphtdocsapplicationviewsusername.php
Line: 47
Function: _error_handler
This is Line 47 - ">
File: C:xampphtdocsapplicationcontrollersUsername.php
Line: 70
Function: view
This is Line 70 - $this->load->view('username', $data);
File: C:xampphtdocsindex.php
Line: 315
Function: require_once
BASE_URLusername">
This is Line 315 - require_once BASEPATH.'core/CodeIgniter.php';
Can somebody advise me of what I need to change?
Update 1
The only place I can find a definition of base_url is in /config/config.php which is following;
$config['base_url'] = 'http://localhost/';
And that has not been changed between my previous work and this current system.
Update 2
In the Controller Username.php there is a load function
$this->load->helper(array('form', 'url'));
But I can't find anything in the helper folder other than index file.
And again that has not been changed between my previous work and this current system.
php codeigniter
add a comment |
up vote
0
down vote
favorite
A while ago I attempted to re-open previous work but could not get the XAMPP Control Panel to open, I guess because I re-installed Windows 10. I then decided to download the latest versions of XAMPP & CodeIgniter and then transfer my previous files to the new system.
Previous CI_VERSION = '3.1.1' - Latest CI_VERSION = '3.1.9' - Previous PHP version: 7.0.8 - Latest PHP version 7.2.3
When my current system directs to the "username" page which is where the username & password are created, I get the following error. This function was working OK in my previous system. It appears to be caused by a difference between the versions of PHP.
A PHP Error was encountered
Severity: Warning
Message: Use of undefined constant BASE_URL - assumed 'BASE_URL' (this will throw an Error in a future version of PHP)
Filename: username.php
Line Number: 47
This is Line 47
<form class="form" method="post" action="<?php echo BASE_URL . 'username'; ?>">
Backtrace:
File: C:xampphtdocsapplicationviewsusername.php
Line: 47
Function: _error_handler
This is Line 47 - ">
File: C:xampphtdocsapplicationcontrollersUsername.php
Line: 70
Function: view
This is Line 70 - $this->load->view('username', $data);
File: C:xampphtdocsindex.php
Line: 315
Function: require_once
BASE_URLusername">
This is Line 315 - require_once BASEPATH.'core/CodeIgniter.php';
Can somebody advise me of what I need to change?
Update 1
The only place I can find a definition of base_url is in /config/config.php which is following;
$config['base_url'] = 'http://localhost/';
And that has not been changed between my previous work and this current system.
Update 2
In the Controller Username.php there is a load function
$this->load->helper(array('form', 'url'));
But I can't find anything in the helper folder other than index file.
And again that has not been changed between my previous work and this current system.
php codeigniter
Possible duplicate of What does the PHP error message "Notice: Use of undefined constant" mean?
– Qirel
Nov 10 at 14:05
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
A while ago I attempted to re-open previous work but could not get the XAMPP Control Panel to open, I guess because I re-installed Windows 10. I then decided to download the latest versions of XAMPP & CodeIgniter and then transfer my previous files to the new system.
Previous CI_VERSION = '3.1.1' - Latest CI_VERSION = '3.1.9' - Previous PHP version: 7.0.8 - Latest PHP version 7.2.3
When my current system directs to the "username" page which is where the username & password are created, I get the following error. This function was working OK in my previous system. It appears to be caused by a difference between the versions of PHP.
A PHP Error was encountered
Severity: Warning
Message: Use of undefined constant BASE_URL - assumed 'BASE_URL' (this will throw an Error in a future version of PHP)
Filename: username.php
Line Number: 47
This is Line 47
<form class="form" method="post" action="<?php echo BASE_URL . 'username'; ?>">
Backtrace:
File: C:xampphtdocsapplicationviewsusername.php
Line: 47
Function: _error_handler
This is Line 47 - ">
File: C:xampphtdocsapplicationcontrollersUsername.php
Line: 70
Function: view
This is Line 70 - $this->load->view('username', $data);
File: C:xampphtdocsindex.php
Line: 315
Function: require_once
BASE_URLusername">
This is Line 315 - require_once BASEPATH.'core/CodeIgniter.php';
Can somebody advise me of what I need to change?
Update 1
The only place I can find a definition of base_url is in /config/config.php which is following;
$config['base_url'] = 'http://localhost/';
And that has not been changed between my previous work and this current system.
Update 2
In the Controller Username.php there is a load function
$this->load->helper(array('form', 'url'));
But I can't find anything in the helper folder other than index file.
And again that has not been changed between my previous work and this current system.
php codeigniter
A while ago I attempted to re-open previous work but could not get the XAMPP Control Panel to open, I guess because I re-installed Windows 10. I then decided to download the latest versions of XAMPP & CodeIgniter and then transfer my previous files to the new system.
Previous CI_VERSION = '3.1.1' - Latest CI_VERSION = '3.1.9' - Previous PHP version: 7.0.8 - Latest PHP version 7.2.3
When my current system directs to the "username" page which is where the username & password are created, I get the following error. This function was working OK in my previous system. It appears to be caused by a difference between the versions of PHP.
A PHP Error was encountered
Severity: Warning
Message: Use of undefined constant BASE_URL - assumed 'BASE_URL' (this will throw an Error in a future version of PHP)
Filename: username.php
Line Number: 47
This is Line 47
<form class="form" method="post" action="<?php echo BASE_URL . 'username'; ?>">
Backtrace:
File: C:xampphtdocsapplicationviewsusername.php
Line: 47
Function: _error_handler
This is Line 47 - ">
File: C:xampphtdocsapplicationcontrollersUsername.php
Line: 70
Function: view
This is Line 70 - $this->load->view('username', $data);
File: C:xampphtdocsindex.php
Line: 315
Function: require_once
BASE_URLusername">
This is Line 315 - require_once BASEPATH.'core/CodeIgniter.php';
Can somebody advise me of what I need to change?
Update 1
The only place I can find a definition of base_url is in /config/config.php which is following;
$config['base_url'] = 'http://localhost/';
And that has not been changed between my previous work and this current system.
Update 2
In the Controller Username.php there is a load function
$this->load->helper(array('form', 'url'));
But I can't find anything in the helper folder other than index file.
And again that has not been changed between my previous work and this current system.
php codeigniter
php codeigniter
edited Nov 10 at 19:14
asked Nov 10 at 14:03
user225359
14117
14117
Possible duplicate of What does the PHP error message "Notice: Use of undefined constant" mean?
– Qirel
Nov 10 at 14:05
add a comment |
Possible duplicate of What does the PHP error message "Notice: Use of undefined constant" mean?
– Qirel
Nov 10 at 14:05
Possible duplicate of What does the PHP error message "Notice: Use of undefined constant" mean?
– Qirel
Nov 10 at 14:05
Possible duplicate of What does the PHP error message "Notice: Use of undefined constant" mean?
– Qirel
Nov 10 at 14:05
add a comment |
4 Answers
4
active
oldest
votes
up vote
0
down vote
The constant BASE_URL
was defined somewhere in the old code but is not in the new. CodeIgniter does not define a constant called BASE_URL
so it was done in some custom code. It probably looked something like this
define('BASE_URL', base_url());
There are other ways to obtain the value so the main thing to look for is define('BASE_URL',
.
Likely places to look are customized versions of /config/config.php
or /config/constants.php
, but there are lots of other places including a base controller, custom library or some other user-created configuration file.
add a comment |
up vote
0
down vote
I couldn't find any constant called BASE_URL
in the latest CodeIgniter source code.
Their documentation recommends using the base_url()
function for returning the site's base URL.
https://www.codeigniter.com/user_guide/helpers/url_helper.html?highlight=base_url#base_url
There was, however, and older repo on GitHub where I could find a version of CodeIgniter where the constant BASE_URL
was defined in the constants.php file.
https://github.com/assoft/codeigniter/blob/master/application/config/constants.php
Probably this was common practice for older versions.
So, in your example you can use the base_url()
function. This should output http://www.example.com/username
<form class="form" method="post" action="<?php echo base_url('username'); ?>">
You have to import the url helper in the method of the controller corresponding to the view you're using.
$this->load->helper('url');
You should also fill in the value for the base url in the application/config/config.php file.
$config['base_url'] = 'http://www.example.com';
add a comment |
up vote
0
down vote
you have to define base_url. i am using this in header file.
<script>
var base_url = '<?php echo base_url(); ?>';
</script>
add a comment |
up vote
0
down vote
I found my problem. In constants.php of my old system there is the following,
define('BASE_URL', 'http://localhost/');
I copied that into the my current contants.php file and it works, that is to say I don't get the error.
add a comment |
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
The constant BASE_URL
was defined somewhere in the old code but is not in the new. CodeIgniter does not define a constant called BASE_URL
so it was done in some custom code. It probably looked something like this
define('BASE_URL', base_url());
There are other ways to obtain the value so the main thing to look for is define('BASE_URL',
.
Likely places to look are customized versions of /config/config.php
or /config/constants.php
, but there are lots of other places including a base controller, custom library or some other user-created configuration file.
add a comment |
up vote
0
down vote
The constant BASE_URL
was defined somewhere in the old code but is not in the new. CodeIgniter does not define a constant called BASE_URL
so it was done in some custom code. It probably looked something like this
define('BASE_URL', base_url());
There are other ways to obtain the value so the main thing to look for is define('BASE_URL',
.
Likely places to look are customized versions of /config/config.php
or /config/constants.php
, but there are lots of other places including a base controller, custom library or some other user-created configuration file.
add a comment |
up vote
0
down vote
up vote
0
down vote
The constant BASE_URL
was defined somewhere in the old code but is not in the new. CodeIgniter does not define a constant called BASE_URL
so it was done in some custom code. It probably looked something like this
define('BASE_URL', base_url());
There are other ways to obtain the value so the main thing to look for is define('BASE_URL',
.
Likely places to look are customized versions of /config/config.php
or /config/constants.php
, but there are lots of other places including a base controller, custom library or some other user-created configuration file.
The constant BASE_URL
was defined somewhere in the old code but is not in the new. CodeIgniter does not define a constant called BASE_URL
so it was done in some custom code. It probably looked something like this
define('BASE_URL', base_url());
There are other ways to obtain the value so the main thing to look for is define('BASE_URL',
.
Likely places to look are customized versions of /config/config.php
or /config/constants.php
, but there are lots of other places including a base controller, custom library or some other user-created configuration file.
answered Nov 10 at 15:56
DFriend
6,5741520
6,5741520
add a comment |
add a comment |
up vote
0
down vote
I couldn't find any constant called BASE_URL
in the latest CodeIgniter source code.
Their documentation recommends using the base_url()
function for returning the site's base URL.
https://www.codeigniter.com/user_guide/helpers/url_helper.html?highlight=base_url#base_url
There was, however, and older repo on GitHub where I could find a version of CodeIgniter where the constant BASE_URL
was defined in the constants.php file.
https://github.com/assoft/codeigniter/blob/master/application/config/constants.php
Probably this was common practice for older versions.
So, in your example you can use the base_url()
function. This should output http://www.example.com/username
<form class="form" method="post" action="<?php echo base_url('username'); ?>">
You have to import the url helper in the method of the controller corresponding to the view you're using.
$this->load->helper('url');
You should also fill in the value for the base url in the application/config/config.php file.
$config['base_url'] = 'http://www.example.com';
add a comment |
up vote
0
down vote
I couldn't find any constant called BASE_URL
in the latest CodeIgniter source code.
Their documentation recommends using the base_url()
function for returning the site's base URL.
https://www.codeigniter.com/user_guide/helpers/url_helper.html?highlight=base_url#base_url
There was, however, and older repo on GitHub where I could find a version of CodeIgniter where the constant BASE_URL
was defined in the constants.php file.
https://github.com/assoft/codeigniter/blob/master/application/config/constants.php
Probably this was common practice for older versions.
So, in your example you can use the base_url()
function. This should output http://www.example.com/username
<form class="form" method="post" action="<?php echo base_url('username'); ?>">
You have to import the url helper in the method of the controller corresponding to the view you're using.
$this->load->helper('url');
You should also fill in the value for the base url in the application/config/config.php file.
$config['base_url'] = 'http://www.example.com';
add a comment |
up vote
0
down vote
up vote
0
down vote
I couldn't find any constant called BASE_URL
in the latest CodeIgniter source code.
Their documentation recommends using the base_url()
function for returning the site's base URL.
https://www.codeigniter.com/user_guide/helpers/url_helper.html?highlight=base_url#base_url
There was, however, and older repo on GitHub where I could find a version of CodeIgniter where the constant BASE_URL
was defined in the constants.php file.
https://github.com/assoft/codeigniter/blob/master/application/config/constants.php
Probably this was common practice for older versions.
So, in your example you can use the base_url()
function. This should output http://www.example.com/username
<form class="form" method="post" action="<?php echo base_url('username'); ?>">
You have to import the url helper in the method of the controller corresponding to the view you're using.
$this->load->helper('url');
You should also fill in the value for the base url in the application/config/config.php file.
$config['base_url'] = 'http://www.example.com';
I couldn't find any constant called BASE_URL
in the latest CodeIgniter source code.
Their documentation recommends using the base_url()
function for returning the site's base URL.
https://www.codeigniter.com/user_guide/helpers/url_helper.html?highlight=base_url#base_url
There was, however, and older repo on GitHub where I could find a version of CodeIgniter where the constant BASE_URL
was defined in the constants.php file.
https://github.com/assoft/codeigniter/blob/master/application/config/constants.php
Probably this was common practice for older versions.
So, in your example you can use the base_url()
function. This should output http://www.example.com/username
<form class="form" method="post" action="<?php echo base_url('username'); ?>">
You have to import the url helper in the method of the controller corresponding to the view you're using.
$this->load->helper('url');
You should also fill in the value for the base url in the application/config/config.php file.
$config['base_url'] = 'http://www.example.com';
answered Nov 10 at 18:37
Dan D.
473110
473110
add a comment |
add a comment |
up vote
0
down vote
you have to define base_url. i am using this in header file.
<script>
var base_url = '<?php echo base_url(); ?>';
</script>
add a comment |
up vote
0
down vote
you have to define base_url. i am using this in header file.
<script>
var base_url = '<?php echo base_url(); ?>';
</script>
add a comment |
up vote
0
down vote
up vote
0
down vote
you have to define base_url. i am using this in header file.
<script>
var base_url = '<?php echo base_url(); ?>';
</script>
you have to define base_url. i am using this in header file.
<script>
var base_url = '<?php echo base_url(); ?>';
</script>
answered Nov 12 at 7:05
PHP Geek
1,1691817
1,1691817
add a comment |
add a comment |
up vote
0
down vote
I found my problem. In constants.php of my old system there is the following,
define('BASE_URL', 'http://localhost/');
I copied that into the my current contants.php file and it works, that is to say I don't get the error.
add a comment |
up vote
0
down vote
I found my problem. In constants.php of my old system there is the following,
define('BASE_URL', 'http://localhost/');
I copied that into the my current contants.php file and it works, that is to say I don't get the error.
add a comment |
up vote
0
down vote
up vote
0
down vote
I found my problem. In constants.php of my old system there is the following,
define('BASE_URL', 'http://localhost/');
I copied that into the my current contants.php file and it works, that is to say I don't get the error.
I found my problem. In constants.php of my old system there is the following,
define('BASE_URL', 'http://localhost/');
I copied that into the my current contants.php file and it works, that is to say I don't get the error.
answered Nov 12 at 15:19
user225359
14117
14117
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53239738%2fphp-error-base-url-username-codeigniter%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Possible duplicate of What does the PHP error message "Notice: Use of undefined constant" mean?
– Qirel
Nov 10 at 14:05