PHP7.0 Phar issues with apache2 - apache2

I have created PHP file within a folder,
/var/www/folder/test.php:
<?php
echo "Test file called!" ;
I have then created a PHAR via the cli:
php -d "phar.readonly = 0"
-r "(new Phar('/var/www/app.phar'))->buildFromDirectory('folder') ;"
I can call the PHP file directly from within the Phar when mod-php5 is enabled, but not when mod-php7.0 is?
$ apt-get install apache2
$ curl localhost/app.phar/test.php
Test file called!
$ apt-get install php7.0 php7.0-common php7.0*
$ a2dismod php5
$ a2enmod php7.0
$ service apache2 restart
$ curl localhost/app.phar/test.php
...
<title>File Not Found</title>...
<h1>404 - File /test.php Not Found</h1>
...
We currently run a mixture of Tomcat and Apache2 so are sadly invested in our way of deploying WAR and PHAR files.

Related

How to find ngrok installation path?

I am using Ubuntu 18.04 I have installed ngrok using below command:
curl -s https://ngrok-agent.s3.amazonaws.com/ngrok.asc | sudo tee /etc/apt/trusted.gpg.d/ngrok.asc >/dev/null && echo "deb https://ngrok-agent.s3.amazonaws.com buster main" | sudo tee /etc/apt/sources.list.d/ngrok.list && sudo apt update && sudo apt install ngrok
It is installed fine and is also working fine. I am now creating a systemd service for it. For that I need to know the installation path of ngrok. I did which ngrok, it shows me the path /usr/local/bin/ngrok. Where is its config file stored?

How can I install Apache Solr into a specified directory in Ubuntu 18.04 LTS

I have installed Apache Solr into Ubuntu 18.04 LTS. I have used the following commands:
cd /vm
sudo wget http://apache-mirror.8birdsvideo.com/lucene/solr/8.2.0/solr-8.2.0.tgz
tar xzf solr-8.2.0.tgz solr-8.2.0/bin/install_solr_service.sh --strip-components=2
sudo bash ./install_solr_service.sh solr-8.2.0.tgz -d /vm
I am trying to install everything into a folder /vm.
But it throws an error and installs everything under /opt.
Everything works fine and I am able to add core, add a document, etc.
I want to be able to install it into my specified folder and I am not able to find an option for that. Is there any way to do this?
The parameter to give the install directory is -i /vm. -d configures the data directory.
The example from the manual that replicates the default settings:
sudo bash ./install_solr_service.sh solr-6.6.0.tgz -i /opt -d /var/solr -u solr -s solr -p 8983

How to install nexus on ubuntu-18.04

I need help in installing nexus-oss on ubuntu18.04. I am not able to find any apt-get commands on internet.
I tried to search for nexus packages in "sudo apt-get search nexus", but could not get a proper nexus version package.
I have browsed over the net, where the commands are available for centos7 but not for Debian os.
In sonatype documentation, the steps are present to create repository manager on ubuntu, is it the same as installing nexus on ubuntu?
Install Java
$ sudo apt-get update
$ sudo apt install openjdk-8-jre-headless -y
Download Nexus
$cd /opt
$ sudo wget https://sonatype-download.global.ssl.fastly.net/repository/repositoryManager/3/nexus-3.16.1-02-unix.tar.gz
$ sudo tar -zxvf nexus-3.16.1-02-unix.tar.gz
$ sudo mv /opt/nexus-3.16.1-02 /opt/nexus
As a good security practice, it is not advised to run nexus service as root. so create a new user called nexus and grant sudo access to manage nexus services.
$ sudo adduser nexus
Set no password for nexus user and enter below command to edit sudo file
$sudo visudo
Add the below line and Save.
nexus ALL=(ALL) NOPASSWD: ALL
Change file and owner permission for nexus files
$ sudo chown -R nexus:nexus /opt/nexus
$ sudo chown -R nexus:nexus /opt/sonatype-work
Add nexus as a service at boot time
Open /opt/nexus/bin/nexus.rc file, uncomment run_as_user parameter and set it as following.
$ sudo vim /opt/nexus/bin/nexus.rc
run_as_user="nexus" (file shold have only this line)
Add nexus as a service at boot time
$ sudo ln -s /opt/nexus/bin/nexus /etc/init.d/nexus
Log in as a nexus user and start service
$ su - nexus
$ /etc/init.d/nexus start
Check the port is running or not using netstat command
$ sudo netstat -plnt
Allow the port 8081 and access the nexus http://:8081
Login as a min default username and password is admin/admin123

Install Adminer on Ubuntu 18.04 bionic

I'm trying to install Adminer from Ubuntu repository using:
sudo apt install adminer
Installation works fine but can't find the file /etc/adminer/apache.conf to use with Apache server. The folder /etc/adminer/ is empty and can't find it anywhere with find command.
Any help?
Thanks in advance.
In the next few steps, I'll show you how I installed adminer for Ubuntu 18.04.1 LTS .
After installation with apt package manager change into the adminer directory.
cd /usr/share/adminer
There you will find a file called compile.php.
Run the following command and the adminer-X.X.X.php (X.X.X for your version) file will be created.
sudo php compile.php
Create the apache adminer configuration file.
sudo echo "Alias /adminer.php /usr/share/adminer/adminer-X.X.X.php" | sudo tee /etc/apache2/conf-available/adminer.conf
Now you'll need to activate the configuration.
cd /etc/apache2/conf-available/
sudo a2enconf adminer.conf
Reload your apache webserver.
sudo systemctl reload apache2.
Test in your browser of choice (localhost/adminer.php)
This source was really helpful:
https://www.linuxhelp.com/how-to-install-adminer-on-ubuntu-16-04/
Install Apache:
sudo apt-get install apache2
Install PHP:
sudo apt-get install php libapache2-mod-php php-mysql
Install Adminer:
sudo wget "http://www.adminer.org/latest.php" -O /var/www/html/adminer.php
Once the installation completes, restart Apache.
sudo service apache2 restart
At this point, the setup is complete. You can access Adminer at the following address.
http://[SERVER_IP]/adminer.php

xdebug with php 7 on ubuntu apache2 not working

actually had that problem and took me allot of time to figure out the solution: (if any previous php versions where installed, make sure to first get completely rid of them. if necessary purge and reinstall apache2 and php7)
first:
> sudo apt-get install php-xdebug
then edit the php.ini file of php 7 :
> sudo gedit /etc/php/7.0/apache2/php.ini
and just on the bottom add:
xdebug.remote_enable = On
save and of course then:
> sudo service apache2 restart
Download stable release of xdebug 2.4.0
wget -c "http://xdebug.org/files/xdebug-2.4.0.tgz"
Extract archive
tar -xf xdebug-2.4.0.tgz
cd xdebug-2.4.0/
Build extension
phpize
./configure
make && make install
Enable the extension
echo "zend_extension=xdebug.so" > /etc/apache2/mods-available/xdebug.ini
ln -sf /etc/apache2/mods-available/xdebug.ini /etc/apache2/mods-enabled/20-xdebug.ini
ln -sf /etc/apache2/mods-available/xdebug.ini /etc/apache2/mods-enabled/20-xdebug.ini
service php7.0-fpm restart
Check it
php -m | grep -i xdebug
It should print:
xdebug
Xdebug

Resources