Use of undefined constant DIR_CACHE - assumed 'DIR_CACHE' - php

I was trying to upgrade my opencart version 1.5.6.4 to the latest one, 3.0.2.0 and followed all the instructions and was able to do it. I did the install procedure from mysite.com/install but got the error 1051 which i fixed by a solution here.
Anyway, Now I have done everything, I am getting following code on
[homepage][1]:-
Notice: Use of undefined constant DIR_CACHE - assumed 'DIR_CACHE' in /home/msgcl/public_html/ocart/system/library/cache/file.php on line 9
Notice: Use of undefined constant DIR_CACHE - assumed 'DIR_CACHE' in /home/msgcl/public_html/ocart/system/library/cache/file.php on line 25
Notice: Use of undefined constant DIR_CACHE - assumed 'DIR_CACHE' in /home/msgcl/public_html/ocart/system/library/cache/file.php on line 63
Notice: Use of undefined constant DIR_CACHE - assumed 'DIR_CACHE' in /home/msgcl/public_html/ocart/system/library/cache/file.php on line 47
Notice: Use of undefined constant DIR_CACHE - assumed 'DIR_CACHE' in /home/msgcl/public_html/ocart/system/library/cache/file.php on line 25
Error: A theme has not beeareassigned to this store!
There are also two pop-ups I get after I log in from admin page with something like:
Syntax error - unexpected token > in JSON at position 0
any ideas what this could be referring to? Any help would be appreciated.

Not sure if this is the officially approved fix, but the following worked for me:
In your opencart folder, open the config.php and admin/config.php files and add the following lines to both (adjust the file paths for your installation):
define('DIR_MODIFICATION', '/your/Path/To/opencart/system/modification/');
define('DIR_CACHE', '/your/Path/To/opencart/system/cache/');
define('DIR_LOGS', '/your/Path/To/opencart/system/logs/');
I had similar errors for DIR_MODIFICATION and DIR_LOGS, hence three lines.
Also created the directories on the server in the system subfolder.
Credits for the jump start about he DIR_MODIFICATION error to:
http://www.betterhostreview.com/undefined-constant-dir_modification-opencart-error.html

Related

WordPress "Notice: Undefined index: host" after initial setup running locally on linux

I'm trying to set up WordPress on my laptop running Kali Linux. Everything works until I install WordPress and the theme I am using. I'm trying to use roots sage on bedrock. But after I get through the installation process I get a notice in the admin:
Notice: Undefined index: host in /var/www/html/site/web/wp/wp-includes/theme.php on line 2937
Notice: Undefined index: host in /var/www/html/site/web/wp/wp-includes/theme.php on line 2937
Notice: Undefined index: host in /var/www/html/site/web/wp/wp-includes/theme.php on line 2999
Notice: Undefined index: host in /var/www/html/site/web/wp/wp-includes/theme.php on line 2999
And in the frontend:
Notice: Undefined index: host in /var/www/html/site/web/wp/wp-includes/theme.php on line 2999
Notice: Undefined index: host in /var/www/html/site/web/wp/wp-includes/theme.php on line 2999
Can anyone explain why I'm getting these notices? I must have missed something but I've gone through the instructions several times and I'm out of ideas. Thanks
You can define WP_HOME & WP_SITEURL in wp-config.php
define('WP_HOME','http://localhost/project_folder_name');
define('WP_SITEURL','http://localhost/project_folder_name');
This can also be caused by an error with the siteurl and home options in wp_options table.
Make sure the url's have a host as well, http://example.com not just example.com.
I just now came across this and for me, switching back from PHP 8.x.x to PHP 7.x.x resolved the issue.

new XAMPP giving me million errors

I used to have old version of Portable Xampp, all my codes where running correctly.
Today I installed the latest version - portable (then I tried install).
The pages is giving a lot of errors and the code is not running
something like this:
Notice: Use of undefined constant server_name - assumed 'server_name' in D:\xampp\htdocs\aviaeng\settings.php on line 14
Notice: Use of undefined constant db_name - assumed 'db_name' in D:\xampp\htdocs\aviaeng\settings.php on line 15
Notice: Use of undefined constant username - assumed 'username' in D:\xampp\htdocs\aviaeng\settings.php on line 16
Notice: Use of undefined constant password - assumed 'password' in D:\xampp\htdocs\aviaeng\settings.php on line 17
Notice: Use of undefined constant contact_email - assumed 'contact_email' in D:\xampp\htdocs\aviaeng\settings.php on line 18
and on the browser I have
<? echo $lang[website_name] ?>
which means the PHP is not being read by Xampp.
What am I doing wrong ?
It seems that your code is not compatible syntaxically speaking with the new PHP version you installed.
With patience, you can debug your code to adapt its syntax to your new PHP version. Courage :)

SMF - Upgrading 1-19 to 2-7 (upgrade.php)

i decided to move my 1.1.19 to 2.07 and move to new directory.
but i couldn't upgrade my forum correctly. because:
repair_settings.php - (in bottom of page we got some error)
Notice: Undefined index: database_error in
/homepages/5/d394578306/htdocs/ResidentEvil/Sources/Subs-Db-mysql.php
on line 572
Fatal error: Call to undefined function allowedTo() in
/homepages/5/d394578306/htdocs/ResidentEvil/Sources/Subs-Db-mysql.php
on line 573
Upgrade.php - (we have many error on this page)
Notice: Undefined index: upgrade_progress in
/homepages/5/d394578306/htdocs/ResidentEvil/upgrade.php on line 3488
same error but on different lines.
Seems you're missing some files. Reupload all the Sources dir and the upgrade files with a software like WinSCP. Avoid FileZilla.

PHP Error log file format (php.ini error_log directive) on Windows

For an example:
php.ini file
...
; Log errors to specified file.
error_log = c:/php/php.log
...
Error log file (c:/php/php.log) contains every entry in this format:
[12-Jun-2011 12:58:55] PHP Notice: Undefined variable: test in C:\www\phpinfo.php on line 2\r\r\n
[12-Jun-2011 12:59:01] PHP Notice: Undefined variable: test in C:\www\phpinfo.php on line 2\r\r\n
[12-Jun-2011 13:01:12] PHP Notice: Undefined variable: test in C:\www\phpinfo.php on line 2\r\r\n
[12-Jun-2011 13:02:11] PHP Notice: Undefined variable: test in C:\www\phpinfo.php on line 2\r\r\n
[12-Jun-2011 13:11:23] PHP Notice: Undefined variable: test in C:\www\phpinfo.php on line 2\r\r\n
[12-Jun-2011 13:12:10] PHP Notice: Undefined variable: test in C:\www\phpinfo.php on line 2\r\r\n
Two carriage return character and one new line per one error line.
Why it happens?
How to change error log file to default format:
[12-Jun-2011 12:58:55] PHP Notice: Undefined variable: test in C:\www\phpinfo.php on line 2\r\n
[12-Jun-2011 12:59:01] PHP Notice: Undefined variable: test in C:\www\phpinfo.php on line 2\r\n
[12-Jun-2011 13:01:12] PHP Notice: Undefined variable: test in C:\www\phpinfo.php on line 2\r\n
[12-Jun-2011 13:02:11] PHP Notice: Undefined variable: test in C:\www\phpinfo.php on line 2\r\n
[12-Jun-2011 13:11:23] PHP Notice: Undefined variable: test in C:\www\phpinfo.php on line 2\r\n
[12-Jun-2011 13:12:10] PHP Notice: Undefined variable: test in C:\www\phpinfo.php on line 2\r\n
PHP Version 5.3.6
Apache/2.2.15 (Win32)
Tested on Windows 7 Home Basic and Windows XP SP3, same results.
php.ini file contains only two strings
log_errors = On
error_log = c:/server/php.log
apache phpinfo() script -> http://pastehtml.com/view/awvx1vgpp.html
PS.
sever: nginx 1.0.4
FastCGI + PHP Version 5.3.6
Everything works as expected.
nginx phpinfo() script -> http://pastehtml.com/view/awvwvk9p9.html
There are more ini directives to control the output into the error log. These are explained on this PHP manual page.
By default, PHP running with not loading the ini and only having the error_log set and logging enabled, it does output a single line only. You can test that on your system as well, it demonstrates it well for the Command Line Interface (CLI) "Server Application Programming Interface (API) [SAPI]":
php -n -d error_log=./error.log -d log_errors=1 -r 'error;'
Use this command to make an isolated run and compare it with your output. If it has two line endings as well, then this is probably a bug of your php version.
If not a problem with the PHP version [not the case in the original posting (OP)] then within your application some settings looks to be altered. You need to find out which setting. Probably you can find it by registering an own error handler and then dumping the ini settings.
Last but not least, if it isn't a misunderstanding of the line ending (see my comment), then one may want to also look in the ini settings named error_prepend_string and error_append_string regarding the error display (but not the error logging).

How to get the Ansinerator library to work?

I'm trying to get the Ansinerator library to work my on my localhost, but something's amiss.
I'm receiving the following errors:
Notice: Undefined index: hash in ansi.php on line 23 Notice: Undefined index: aml in ansi.php on line 37 Notice: Undefined variable: PNG_DESTRUCT in ansi.php on line 119 Notice: Undefined offset: -1 in ansi.php on line 362 Notice: Trying to get property of non-object in ansi.php on line 362 Notice: Undefined variable: links in ansi.php on line 459 Notice: Trying to get property of non-object in ansi.php on line 677 Notice: Undefined variable: links in ansi.php on line 459 Notice: Undefined variable: map_link in ansi.php on line 687
Any idea where am I going wrong with this one? I've installed the php-gd library, restarted the server, and while runs perfectly on production server, localhost will refuse. Ideas?
Thank you.
Check
- That you've got 'proper' versions of everything installed on localhost. (Compare localhost with production.) There's obviously something different between the 2 servers here, just use phpinfo() to check.
Restart localhost again? (Just kidding...)
Is it possible that you have set different error reporting levels on both servers?
Before anything, put error_reporting(E_ALL); at the top of your script on both servers and see if it runs perfectly. (My guess is you will get errors on both servers)

Categories