Whoops! We seem to have hit a snag. Please try again later - codeigniter-4

Whoops! We seem to have hit a snag. Please try again later.
Codeigniter 4 shows an error when I run the CI4 application, How I resolve?
Changes:
public $baseURL = 'http://ci.local';
public $baseURL = 'http://localhost:8080';
public $indexPage = '';

This work for me try it
Go to app directory then to boot directory you will see production.php file.
That is:
app => Config => Boot => production.php
Change the ini_set('display_errors', '0') to ini_set('display_errors', '1').
Warning: When in production change back to initial ini_set('display_errors', '0')
Or
you can rename your file env in your project directory to .env after that open it and edit.
Search for # CI_ENVIRONMENT = production remove # and change production to development
Warning: When in production change back to initial CI_ENVIRONMENT = development to CI_ENVIRONMENT = production
For those experiencing intl error go to where your php installation directory edit the php.ini file remove semi-colon ";" from ;extension=intl to extension=intl. save the file and restart your server. I think this will solve that error. This particular editing of my php.ini was on php 7.2 - 8.1 so I haven't check other version of php lesser than these versions which Codeigniter 4 does not support

After installing CodeIgniter 4 when you run the app then you will get an error like this
To know the error go to the app/Config/Boot/production.php and set display_errors to 1 as below
ini_set('display_errors', '1');
Now, you will see the actual error below
Nothing to worry about it. The app needs permission. Assign the permission like as below
sudo chmod -R 777 project_name

Assume that your root folder of your CI4 project is rootproject.
Edit rootproject/.env file.
On line 17 change from:
# CI_ENVIRONMENT = production
to:
CI_ENVIRONMENT = development
Save it.
Refresh your browser that pointing to your CI4 project.
It should give you many error messages.
If there is something written as CacheException, than your cache folders are not writable.
Make it writable;
Ubuntu:
chown -Rv www-data rootproject/writable
CentOS:
chown -Rv apache rootproject/writable
Easy way:
chmod 777 -Rv rootproject/writable

In your CI4 project root, create a file named .env. It should be in the same directory as system, app e.t.c
Then, add this CI_ENVIRONMENT = development

The problem is most likely due to missing extensions. Check server requirements here.. Check your php.ini file and make sure intl and mbstring are enabled.

I had the same problem, I have a simple solution for Mac.
- in the project folder, go to 'writable'
- select all the folders contained and click on 'get information'
- go share and permissions
- in 'everyone' select 'read and write'
That's it! refresh the page

Try This
Open [xampp]/php/php.ini
Search for ;extension=intl and remove the ;
Save the php.ini file and restart Apache(server).

In Root folder change: env to .env
Change # CI_ENVIRONMENT = production to CI_ENVIRONMENT = development (ensure it is uncommented)
Your error may be related to the knit.php file.
Go to System/Third Party and change: knit.php to Knit.php (Capital)
Reload.

For those using XAMPP in MacOS:
You don't need to change the ownership of the writable directory. You only need to change permission to entire directory:
chmod -R 777 writable

When you change # CI_ENVIRONMENT = production to CI_ENVIRONMENT = development don't forget of rename the env file to .env else it will not work.

You're running in the production environment and need to change it to a Development or Testing environment to see the error messages within the browser.
There are a few ways to do this, but adding:
SetEnv CI_ENVIRONMENT development
To the Apache httpd.config file is what worked for me.
_t

I got the answer for this query; just follow these steps:
From the command line, at your project root just hit this
php spark serve
Then hit this on your browser http://localhost:8080/
Enjoy your Latest CI.

Not sure what the desired answer is, but:
If you are asking to see what is the actual error is - either change
your environment to testing/development (as suggested so far) or you
can check your logs - writable/logs/log-.php
If you wish to solve the error, we will need more information, like have
you setup virtual hosts, have you change .htaccess file in public
folder, etc. Otherwise we will be most likely betting (I bet it's virtual hosts).
In any case, a copy of the displayed error (after changing evnironment) or log file will be useful.

You can check logs file on writable/logs find error information,
If your logs information like :
CRITICAL - 2020-04-19 17:44:55 --> Invalid file: template/header.php
#0 F:\xampp\htdocs\ppdb\vendor\codeigniter4\framework\system\View\View.php(224): CodeIgniter\Exceptions\FrameworkException::forInvalidFile('template/header...')
And go fix your error, in my case i am wrong typed name on controller file

In Codeigniter 4 source code have a folder named writable, just update it's access permission. Sometimes it'll help to get rid of Whoops. Also can check the video for Ubuntu / Linux

Related

Sybase 16 startserver failed due to missing libsapcrypto.so

We've installed Sybase 16 Express in our Linux box, it was able to startup right after the installation. When we recently try restarting it with the startserver -f RUN_FILE command, it failed to find the libsapcrypto.so file.
~/sap/ASE-16_0/bin> ../sap/ASE-16_0/bin/dataserver: error while loading shared libraries: libsapcrypto.so: cannot open shared object file: No such file or directory
We searched this file, multiple matches presented in the following paths:
./DM/OCS-16_0/lib3p/libsapcrypto.so
./DM/OCS-16_0/lib3p64/libsapcrypto.so
./DM/OCS-16_0/devlib3p64/libsapcrypto.so
./DM/OCS-16_0/devlib3p/libsapcrypto.so
./DM/REP-16_0/lib64/libsapcrypto.so
./DataAccess/ODBC/lib/libsapcrypto.so
./DataAccess64/ODBC/lib/libsapcrypto.so
./OCS-16_0/lib3p/libsapcrypto.so
./OCS-16_0/lib3p64/libsapcrypto.so
./OCS-16_0/devlib3p64/libsapcrypto.so
./OCS-16_0/devlib3p/libsapcrypto.so
Since this hasn't been answered yet, running this command worked for me:
. /opt/sap/SYBASE.sh
Note the different syntax to make sure the environment variables are set in the terminal session, as opposed to using this syntax:
/opt/sap/SYBASE.sh

Nodejs fs.copyfile not allowed for copy a file to the destination folder

I am trying to copy a file from one location to another so I'm using this:
fs.copyFile('C:\\Users\\Me\\Documents\\myfile.zip', c:\\myfiles
console.log('file was copied successfully!');
});
I can see that the destination folder is readonly so that's why I'm getting this.
How can I change it's status on my windows pc.
I've tried this but nothing is happening and I still get the error:
fs.chmodSync('c:\\myfiles', 0o755);
How can I fix this issue?
You are using Windows, I guest C:\ is your system disk (where you install the Windows).
If you want to write a file to c:\myfiles , it require you Administrator permission (you can try by way: copy and paste a file to the folder, by hand).
Solution:
Option1: Change your folder, ex: D:\myfiles
Option2: Use windows file manager, change your folder permission (everyone read/write)

Veracode through an error - ASPCONFIG: Could not autodiscover 'components.config'

I have a Veracode plugin in my VS 2013 Professional.
I have ucommerce.dll, Sitecore.Kernel and Sitecore.Analytics.dll
I set copy local true for all above dll files.
When i tried to pre-compile all the web project I'm getting a below error message
1>------ Pre-compile started: Project: XXXXX.Web.PQRPorta\ ------
1>Pre-compiling with command similar to the following:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_compiler.exe -p
"C:/XXXXX.Web.PQRPortal" -v "XXXXX.Web.PQRPortal/" -fixednames -f -c
-d "C:/SVN/trunk/Releases/SourceCode/Source/PrecompiledWeb/XXXXX.Web.PQRPortal"
1>error ASPCONFIG: Could not autodiscover 'components.config'. Make
sure it's present in the application folder
'C:\SVN\trunk\Releases\SourceCode\Source\XXXXX.Web.PQRPortal\' or in a
sub folder. Paths ignored
''C:\SVN\trunk\Releases\SourceCode\Source\XXXXX.Web.PQRPortal\bin',
'C:\SVN\trunk\Releases\SourceCode\Source\XXXXX.Web.PQRPortal\App_Data',
'C:\SVN\trunk\Releases\SourceCode\Source\XXXXX.Web.PQRPortal\obj''
1>XXXXX.Web.PQRPortal\ - 1 error, 0 warnings
Is there any configuration missing?
Update
I found the components.config file inside
C:\inetpub\wwwroot\XXXX\Website\sitecore modules\Shell\uCommerce\Configuration
and I added the file inside the web project root directory and tried to precompile web project, now I’m getting different error error
ASPRUNTIME: Type is not resolved for member 'Castle.Windsor.Configuration.Interpreters.ConfigurationProcessingException,Cast‌​le.Windsor, Version=3.2.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc'.
any solution for it?
The components.config is a file uCommerce need.
The configuration file should be placed somewhere below the uCommerce folder. (not sure where depend on the version) It will automatically be picked up when the application starts up.

Problems configuring my site to use a custom php.ini file for all directories

PHP 5.2.17
joomla 1.6.4
1and1 Linux shared server
php is running as cgi
Hi, I am trying to use a custom php.ini throughout my website. I know I can put a php.ini file in each folder, but that would not be feasible.
I searched online and found the following method:
1 - create your custom php.ini file and put it inside path/to/your/website/cgi-bin folder
2 - create the following php.cgi file
#!/bin/sh
exec /usr/local/bin/php5 -c path/to/your/website/cgi-bin
3 - upload php.cgi to /path/to/your/website/cgi-bin
4 - chmod +x php.cgi to make it executable
5 - include the following line inside .htaccess in my website root
Action application/x-httpd-php5 /path/to/your/website/cgi-bin/php.cgi
According to my understanding, after doing the above, php scripts on my website would start using my custom php.ini file instead of the default one.
Anyone can help? I spent a better part of the day trying to resolve this issue without success.
By the way, my account root (one level above my website root) has a .htaccess file with the following lines:
AddType x-mapp-php5 .php
AddHandler x-mapp-php5 .php
Thank you.
UPDATE 9/2/2011 - 19:37
tried including the following statement in .htaccess
SetEnv PHPRC /path/to/my/website/cgi-bin <- where my custom php.ini file is located.
According to this website it should have worked -> http://support.premiumreseller.com/index.php?_m=knowledgebase&_a=viewarticle&kbarticleid=85
But still nothing.
I will keep trying.
Any help appreciated!!!
UPDATE 2 - 9/3/2011 - 0:03 (WORKAROUND)
So, I couldn't find a solution for my problem. I decided to create a small php script to create hard links to php.ini in each directory that has a php script.
See below the code in case you are curious:
<?php
define('ROOT_DIR', $_SERVER['DOCUMENT_ROOT']);
define('FILE_PHPINI', ROOT_DIR . "/cgi-bin/php.ini");
processdir(ROOT_DIR);
function processdir($path)
{
$FlagNoPHP = true;
$localPHPINI = $path . "/php.ini";
foreach ( new DirectoryIterator($path) as $file)
{
if (!($file->isDot()))
{
if ($file->isDir())
{
processdir($path . "/" . $file);
}
else if ($FlagNoPHP && fnmatch("*.php*", $file))
{
$FlagNoPHP = false;
if (!file_exists($localPHPINI))
{
link(FILE_PHPINI, $localPHPINI);
}
}
}
}
if ($FlagNoPHP)
{
if (file_exists($localPHPINI))
{
unlink($localPHPINI);
}
}
}
?>
The above code looks inside each directory in my website and:
1 - if there is a php script and NO php.ini, creates a hard link to php.ini
2 - if there is NO php script and there is a php.ini, deletes the hard link (done in the last if of the function). I included this in order to clean up the filesystem of old php.ini files.
This worked for me.
I am still curious about an answer to my original problem.
I hope this helps someone!
Seems like you're taking the long way. Just modify .bashrc:
export PHPRC="/Volumes/Mac_Daddy/web_curr/public_html/php_osx.ini"
Result:
Configuration File (php.ini) Path: /usr/local/php5/lib
Loaded Configuration File: /Volumes/Mac_Daddy/web_curr/public_html/php_osx.ini
Scan for additional .ini files in: /usr/local/php5/php.d
Additional .ini files parsed: /usr/local/php5/php.d/10-extension_dir.ini
Or create an alias:
alias myphp="/usr/local/php5/bin/php -c /somewhere/someplace/php.ini"
or better yet man php.

Warbler config.java_classes and log4j.properties

I'm packaging up a rails app with warbler and I want app specific logging. I've added the log4j and commons-loggin jar to the WEB-INF/lib directory, and I want to add log4j.properties to the WEB-INF/classes directory. The problem is, I also want environment specific logging, so my staging/production use different properties (ie. INFO instead of DEBUG) than my devel. I can't just do a:
config.java_classes = FileList["lib/log4j-#{RAILS_ENV}.properties"]
because Tomcat seems to look for the specific file log4j.properties. Is there any way to get warbler to rename this file to just log4j.properties? Or is there a better mechanism for app specific, environment specific logging?
And for the final answer. RAILS_ENV doesn't seem to work in warbler, but looking through the docs on warble config, there's a webxml attribute that contains rails.env, modifying my code to pull the file like:
config.java_classes = FileList["lib/properties/log4j.properties.#{config.webxml.rails.env}"]
Worked like a charm!
Guess I should just read further down in the warble file itself. You can configure pathmaps for the java_classes. Here's what I used:
config.java_classes = FileList["lib/properties/log4j.properties.#{RAILS_ENV}"]
config.pathmaps.java_classes << "%n"
The only problem I've found is that this doesn't actually put the log4j.properties in the WEB-INF/classes directory anymore. It now puts it in the Root. Seems odd that it specifically says in the docs:
One or more pathmaps defining how the java classes should be copied into WEB-INF/classes
I wouldn't think I'd have to add in that WEB-INF/classes path manually but I did. So finally then, this worked:
config.java_classes = FileList["lib/properties/log4j.properties.#{RAILS_ENV}"]
config.pathmaps.java_classes << "WEB-INF/classes/%n"
using the files log4j.properties.#{RAILS_ENV} in the lib/properties directory

Resources