CodeIgniter 4 problem installing with manual - codeigniter-4

CodeIgniter\Exceptions\FrameworkException
The framework needs the following extension(s) installed and loaded: {0}.
SYSTEMPATH\CodeIgniter.php at line 224

I faced same issue and resolve by following below steps:
go to the app=> Config => Boot => production.php in your project
Change the ini_set('display_errors', '0') to ini_set('display_errors', '1')
above will show you the error detail then do the following:
Open [xampp_folder_path]/php/php.ini to edit.
Search for ;extension=intl and remove the ;.
Save the php.ini file and restart Apache.
reference/thanks to:
Chibueze Agwu and mail2bapi

Look for the php.ini file(C:\xampp\php\php.ini:921)
and search for the
extension=intl
line, and
uncomment. Then run the command php spark serve, in the terminal of your application path.

For linux user:
the php used by the apache webserver
/etc/php/{version}/apache2/php.ini
the php used by the terminal/command line
/etc/php/{version}/cli/php.ini
In both case (apache/cli), Search for ;extension=intl and remove the ;.
The next to do is to install the extension if not exist
sudo apt-get install php7.4-intl
Afterwards, restart your apache
sudo systemctl restart apache2
Voila, problem solved

If you are using Docker and an apache image, you need to configure the php intl extension:
FROM php:7.4.27-apache-buster
RUN apt-get -y update \
&& apt-get install -y libicu-dev \
&& docker-php-ext-configure intl \
&& docker-php-ext-install intl;
...
Source:
https://stackoverflow.com/a/57650040/3701102

Related

Running SSH script during Microsoft Azure Web App deployment

I am deploying a web app using the Python-Django framework to Microsoft Azure.
I have succeeded in deploying it, but every time I deploy, I have to open the Azure SSH tool and run the command apt-get install libgtk2.0-dev which I gather is some Linux dependency for the opencv-python image processing library.
I wonder if there is a way to install the required software using deploy.sh files.
deploy.sh
echo "Running Linux Deployment Script..."
apt-get update && apt install -y libxrender1 libxext6
apt-get install -y libfontconfig1
apt-get install libgtk2.0-dev
Thanks in advance for your help.
You can create a script to install libgtk2.0-dev, say test.sh under /home/site.
And then add an app setting under 'Configuration' called PRE_BUILD_SCRIPT_PATH with /home/site/test.sh as the value.
You can run a script on every Webapp startup. Just adjust your script as described here: https://stackoverflow.com/a/69923647/2606766
Create a start.sh file, e.g. like this:
# install package & start app
apt-get update -y
apt install -y libxrender1 libxext6
apt-get install -y libfontconfig1
apt-get install libgtk2.0-dev
# don't forget to start your webapp service at the end of this script, e.g.:
python manage.py runserver
Set it as your startup script:
Note: There are two pitfalls to this approach:
The script must be executable, so either install w/ unix and chmod 755 start.sh or use a git command (see SO).
The packages are installed on every startup, thus you depend on external servers/repositories when starting the webapp.
You can set SCM_POST_DEPLOYMENT_ACTIONS_PATH environment variable to configure a folder. All scripts in this folder will be executed after deployment. As far as I can see this should work both on Windows and Linux.
If you need root permissions then I would suggest to use a custom docker container which has these packages already installed.
You can start by adding this command directly to the startup script, As mentioned in the answer by #HeyMan. But instead of adding a file just add the command there apt-get update && apt install -y libxrender1 libxext6 && apt-get install -y libfontconfig1 && apt-get install libgtk2.0-dev
Add this command in a single line there.
If this method also does not work for you, then you should follow the container based approach.
Create a dockerfile and add all the required dependency there.
docker build to create a docker image.
Push that image to Azure container registry using docker push
Instead of deploying from local git, deploy with help of docker.
Look at this link for help
https://learn.microsoft.com/en-us/azure/container-registry/container-registry-get-started-docker-cli?tabs=azure-cli

How to run vi on docker container?

I have installed docker on my host virtual machine. And now want to create a file using vi.
But it's showing me an error:
bash: vi: command not found
login into container with the following command:
docker exec -it <container> bash
Then , run the following command .
apt-get update
apt-get install vim
The command to run depends on what base image you are using.
For Alpine, vi is installed as part of the base OS. Installing vim would be:
apk -U add vim
For Debian and Ubuntu:
apt-get update && apt-get install -y vim
For CentOS, vi is usually installed with the base OS. For vim:
yum install -y vim
This should only be done in early development. Once you get a working container, the changes to files should be made to your image or configs stored outside of your container. Update your Dockerfile and other files it uses to build a new image. This certainly shouldn't be done in production since changes inside the container are by design ephemeral and will be lost when the container is replaced.
USE THIS:
apt-get update && apt-get install -y vim
Explanation of the above command
apt-get update => Will update the current package
apt-get install => Will install the package
-y => Will by pass the permission, default permission will set to Yes.
vim => Name of the package you want to install.
Your container probably haven't installed it out of the box.
Run apt-get install vim in the terminal and you should be ready to go.
Add the following line in your Dockerfile then rebuild the docker image.
RUN apt-get update && apt-get install -y vim
Alternatively, keep your docker images small by not installing unnecessary editors. You can edit the files over ssh from the docker host to the container:
vim scp://remoteuser#container-ip//path/to/document
error:: bash: vi: command not found
run the below command by logging as root user to the container--
docker exec --user="root" -it (container ID) /bin/bash
apt-get update
apt-get install vim
Use below command in Debian based container:
apt-get install vim-tiny
Complete instruction for using in Dockerfile:
RUN apt-get update && apt-get install --no-install-recommends -y \
vim-tiny \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
It doesn't install unnecessary packages and removes unnecessary downloaded files, so your docker image size won't increase dramatically.
The most voted answer has the correct idea, however, it did not work in my case. The comment from #java25 did the trick in my case. I had to log into the docker container as a root user to install vim. I am just posting the comment as an answer so that it is easier for others, having the similar problem, to find it.
docker exec -ti --user root <container-id> /bin/bash
Once you are inside docker, run the following commands now to install vi.
apt-get update
apt-get install vim
To install within your Docker container you can run command
docker exec apt-get update && apt-get install -y vim
But this will be limited to the container in which vim is installed.
To make it available to all the containers, edit the Dockerfile and add
RUN apt-get update && apt-get install -y vim
or you can also extend the image in the new Dockerfile and add above command. Eg.
FROM < image name >
RUN apt-get update && apt-get install -y vim
Inside container (in docker, not in VM), by default these are not installed.
Even apt-get, wget will not work. My VM is running on Ubuntu 17.10. For me yum package manager worked.
Yum is not part of Debian or ubuntu. It is part of red-hat. But, it works in Ubuntu and it is installed by default like apt-get
To install vim, use this command
yum install -y vim-enhanced
To uninstall vim :
yum uninstall -y vim-enhanced
Similarly,
yum install -y wget
yum install -y sudo
-y is for assuming yes if prompted for any question asked after doing yum install package-name
error:: bash: vim: command not found
Run the below command by logging as root user to the container:
microdnf install -y vim
If you actually want a small editor for simple housekeeping in a docker, use this in your Dockerfile:
RUN apt-get install -y busybox && ln -s /bin/busybox /bin/vi
I used it on an Ubuntu 18 based docker.
(Of course you might need an RUN apt-get update before it but if you are making your own Docker file you probably already have that.)
Usually changing a file in a docker container is not a good idea. Everyone will forget about the change after a while. A good way is to make another docker image from the original one.
Say in a docker image, you need to change a file named myFile.xml under /path/to/docker/image/. So, you need to do.
Copy myFile.xml in your local filesystem and make necessary changes.
Create a file named 'Dockerfile' with the following content-
FROM docker-repo:tag
ADD myFile.xml /path/to/docker/image/
Then build your own docker image with docker build -t docker-repo:v-x.x.x .
Then use your newly build docker image.

'No package nginx available' error CentOS 6.5

I'm trying to install nginx on CentOS 6.5, then I added these lines on file /etc/yum.repos.d/nginx.repo
Then install nginx by:
And I've got a message error: No package nginx available
How can I fix it? I would greatly appreciate any help you can give me in working this problem!
nginx is not a part of base CentOS repository.
But you can install EPEL repositiry to get nginx:
yum install epel-release
and then
yum install nginx
This should work well for oraclelinux7
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
yum -y install nginx
Dockerfile to install nginx on oraclelinux:
FROM oraclelinux:7-slim
RUN rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
RUN yum -y install nginx && yum clean all && rm -rf /var/cache/yum
EXPOSE 80
ENTRYPOINT ["nginx", "-g", "daemon off;"]
Your repo url is having an error.
It is necessary to manually replace $releasever with either "5" (for 5.x) or "6" (for 6.x), depending upon your OS version. Similarly you have to edit the $basearch also.
After that do the following command
yum clean all
yum install nginx
An alternative option is to install the epel repository and install nginx from there.
yum install epel-release
yum clean all
yum install nginx
What worked for me (CentOS 7.1) was removing epel first:
yum remove epel-release
yum install epel-release
yum update
yum install nginx
Install nginx first! Run the following commands to first add the EPEL repository (Extra Packages for Enterprise Linux) and then install nginx.
yum install epel-release
yum install nginx
Try to disable plugins for yum:
vim /etc/yum.conf
set plugins=0, and re-install epel-release:
yum remove epel-release
yum install epel-release
yum install nginx
this works for me, good luck!
Check if it is excluded from the yum source:
Use vi /etc/yum.conf
Check the exclude option
Although the otherwise-posted advice regarding manually setting the $releasever and $basearch values in the repo file will not hurt per se (at least while you stick to the software release referred to by the values you set), it is not strictly necessary.
I also have the exact contents you have posted, in a file named /etc/yum.repos.d/nginx.repo which functions correctly without having set the above values explicitly.
My advice would be to perform a yum updateprior to attempting to install (as it's possible that when you tried to install, yum had not queried all of the repo URLs from the files in /etc/yum.repos.d/ for the latest versions of their databases). Also make absolutely sure that your created file ends in .repo as otherwise it will be ignored by yum.
Failing that, check the SElinux security contexts on the files in that directory - or just go ahead and manually restore them by running restorecon -Rv '/etc/yum.repos.d' and check the file permissions on the manually created repo file(s), which should be owned by root:root and have show 644 as file permissions. To manually amend these, run chmod 644 /etc/yum.repos.d/nginx.repoand chown root:root /etc/yum.repos.d/nginx.repo
I hope that some part of the above resolves your issues!
Check yum.conf file and it's exclude key
In addition to all above answers, Make sure nginx, httpd or any other package you want to install is not in the exclude list of yum.conf file.
Open yum.conf file located at /etc/yum.conf
Check the exclude key and remove nginx* if it's there
Then try to install your package. in this case nginx:
sudo yum install nginx

Nginx - Building from source - not working

I was using this code to install Nginx
aptitude -y install nginx
aptitude -y full-upgrade
This was working fine. However, I want to install my apps from source to give me more control. I then used this code:
cd /opt/
wget http://nginx.org/download/nginx-1.2.3.tar.gz
tar xvfz nginx-1.2.3.tar.gz
cd nginx-1.2.3
./configure
make
make install
However, it seems to have extracted and installed fine on the server, but I cant see anything on my site. The command used to restart my Nginx also no longer works:
/etc/init.d/nginx restart
Is anyone able to give me a bit more information on what might be going wrong?
You need to check, where the server was installed. Probably it was installed to the /usr/local/bin directory. And the binary, that it specified in /etc/init.d/nginx is in /usr/bin.
Also, you can add set -x as the second line in the /etc/init.d/nginx to see what happens when you start it.

Installing Issue in the Debian-Linux Server

I am trying to install Kyoto Cabinet in the Debian-Linux Server by using this commands. However, when I execute
./configure
Command, it gives error
-bash: ./configure: /bin/sh^M: bad interpreter: No such file or directory
Can anybody help me why is this happening and how to solve this issue ? Or any idea why this error can happen ?
Because of the ^M character, the configure file is probably using Windows-style line endings.
Try to convert it to use UNIX-style:
dos2unix configure
or in vi type:
:set fileformat=unix
than save the script and try again.
kyotocabinet is now packaged in debian sid
apt-get install libkyotocabinet-dev --install-suggests
you may need to add this to /etc/apt/sources.list
deb http://cdn.debian.net/debian sid main
For me, an initial installation of Kyoto Cabinet (K.C.) was unsuccessful because C++ and zlib were missing from minimal Centos 6. Eventually, these omissions were discovered and K.C. installed (initial instructions from http://skipperkongen.dk/2013/02/14/giving-kyotocabinet-a-go/):
yum -y install gcc-c++
yum -y install zlib-devel
wget http://fallabs.com/kyotocabinet/pkg/kyotocabinet-1.2.76.tar.gz
tar xzvf kyotocabinet-1.2.76.tar.gz
cd kyotocabinet-1.2.76
./configure && make && make install # takes some time!
Test Kyoto Cabinet with:
kcprototest wicked 5
To install the Kyoto Cabinet API for Python (initial instructions from others):
Test Kyoto Cabinet with:
kcprototest wicked 5
As root, of course:
cd $HOME
yum -y install python-devel
wget http://fallabs.com/kyotocabinet/pythonlegacypkg/kyotocabinet-python-legacy-1.18.tar.gz
tar xzvf kyotocabinet-python-legacy-1.18.tar.gz
cd kyotocabinet-python-legacy-1.18
python setup.py install # may take some time!
Create and run a test program, e.g., testkc.py, from the Kyoto Cabint web site.
It should run OK.
You probably want to make K.C. available outside root. Create a new file:
vi /etc/ld.so.conf.d/usrlocal.conf
and add the line:
/usr/local/lib
Then run
ldconfig -v
Move the testkc.py to a user account and run it there; it should be OK

Resources