PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0
Showing posts with label ubuntu-16.04. Show all posts
Showing posts with label ubuntu-16.04. Show all posts

Sunday, November 13, 2022

[FIXED] How to install Plesk on Ubuntu 16.04

 November 13, 2022     failed-installation, installation, plesk, plesk-onyx, ubuntu-16.04     No comments   

Issue

I am getting this error on my Ubuntu 16.04 LTS system :

The following packages have unmet dependencies:
plesk-php56-snmp : Depends: libsnmp30 (>= 5.7.3+dfsg-1ubuntu4.1~dfsg) but 5.7.3+dfsg-1ubuntu4 is to be installed
plesk-php70-snmp : Depends: libsnmp30 (>= 5.7.3+dfsg-1ubuntu4.1~dfsg) but 5.7.3+dfsg-1ubuntu4 is to be installed
plesk-php71-snmp : Depends: libsnmp30 (>= 5.7.3+dfsg-1ubuntu4.1~dfsg) but 5.7.3+dfsg-1ubuntu4 is to be installed
plesk-php72-snmp : Depends: libsnmp30 (>= 5.7.3+dfsg-1ubuntu4.1~dfsg) but 5.7.3+dfsg-1ubuntu4 is to be installed

output of lsb_release -a :

Distributor ID: Ubuntu

Description: Ubuntu 16.04.3 LTS

Release: 16.04

Codename: xenial


I tried a lot of things , installed a lot of packages, stopped some services but can't resolve. I have 3 domains and will add some more too , so I want to use plesk for easy configurations, but can't install. How can I install plesk on my system?


Solution

It seems that you encountered system repositories misconfiguration. Plesk requires that the system repositories were enabled.

For experiment sake I installed OS from official ubuntu-16.04.3-server-amd64.iso with default settings (just enter-enter-enter):

# cat /etc/*release | grep VERSION
VERSION="16.04.3 LTS (Xenial Xerus)"
VERSION_ID="16.04"
VERSION_CODENAME=xenial

Then Plesk Onyx 17.8 (which is currently default) using one-click installer.

Installation went successfully. I can see, that mentioned packages depends on libsnmp30, but not the specific version:

# apt-cache depends plesk-php56-snmp
plesk-php56-snmp
  Depends: libc6
  Depends: libsnmp30
  Depends: plesk-php56

However, the version which you were missing was already installed:

# dpkg -l | grep libsnmp30
ii  libsnmp30:amd64                    5.7.3+dfsg-1ubuntu4.1                      amd64        SNMP (Simple Network Management Protocol) library

It comes from xenial-updates main repository, which is enabled by default:

# apt-cache showpkg libsnmp30 | grep  4.1 | grep binary-amd64
5.7.3+dfsg-1ubuntu4.1 (/var/lib/apt/lists/us.archive.ubuntu.com_ubuntu_dists_xenial-updates_main_binary-amd64_Packages) (/var/lib/dpkg/status)

Just in case, here is my sources.list:

# cat /etc/apt/sources.list | grep -v "^#"
deb http://us.archive.ubuntu.com/ubuntu/ xenial main restricted
deb http://us.archive.ubuntu.com/ubuntu/ xenial-updates main restricted
deb http://us.archive.ubuntu.com/ubuntu/ xenial universe
deb http://us.archive.ubuntu.com/ubuntu/ xenial-updates universe
deb http://us.archive.ubuntu.com/ubuntu/ xenial multiverse
deb http://us.archive.ubuntu.com/ubuntu/ xenial-updates multiverse
deb http://us.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu xenial-security main restricted
deb http://security.ubuntu.com/ubuntu xenial-security universe
deb http://security.ubuntu.com/ubuntu xenial-security multiverse


Answered By - Elvis Plesky
Answer Checked By - Timothy Miller (PHPFixing Admin)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

Thursday, October 6, 2022

[FIXED] How to list all projects added to a solution in Linux terminal?

 October 06, 2022     .net, linux, terminal, ubuntu-16.04     No comments   

Issue

In Ubuntu terminal I can add a project to a solution with the following:

dotnet sln add ./projectName/projectName.csproj

What command can I run in the terminal, to see all the projects that have been added?


Solution

Use dotnet sln list. If multiple solutions are present in folder - add solution name:

dotnet sln SolutionName.sln list
  • dotnet sln list
  • dotnet list reference (for projects)


Answered By - Guru Stron
Answer Checked By - Robin (PHPFixing Admin)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

Wednesday, September 21, 2022

[FIXED] How can i set htaccess file for virtual host?

 September 21, 2022     .htaccess, apache, ubuntu-16.04, virtualhost     No comments   

Issue

I created a virtual host with this code :

<VirtualHost *:80>

    ServerAdmin admin@127.0.0.1
    ServerName site.ws
    ServerAlias www.site.ws
    DocumentRoot /home/me/Projects/website/build
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

<Directory /home/me/Projects/website/build>

        Allow from all
        Satisfy any

</Directory>

</VirtualHost>

and I created a .htaccess file in my /build directory with this code :

RewriteEngine On

RewriteRule   ^(.*)$    $1.html    [R,NC]

Consider my mod_rewrite is active in apache2, but I can't open pages with /filename

e.g site.ws/about

It shows error : The requested URL /about was not found on this server.


Solution

I try this with Apache2 2.4.27 in win:

First enable vhost in httpd.conf file.

vhost:

<VirtualHost *:80>
    ServerName site.ws
    DocumentRoot /home/me/Projects/website/build
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
    <Directory /home/me/Projects/website/build>
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

.htaccess:

###START MOD_REWRITE
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /

    #REMOVE .html EXTENSION
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^([^\.]+)$ $1.html [NC,L]

</IfModule>
###END MOD_REWRITE


Answered By - benny-ben
Answer Checked By - Dawn Plyler (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

Monday, September 5, 2022

[FIXED] What is the default location for Redis AOF file for Ubuntu?

 September 05, 2022     redis, ubuntu-16.04     No comments   

Issue

Background

Yesterday our machine crashed unexpectedly and our AOF file for Redis got corrupted.

Upon trying to start the service with sudo systemctl start redis-server we are greeted with the following logs:

Bad file format reading the append only file: make a backup of your AOF file, then use ./redis-check-aof --fix

Research

Aparently this looks like a simple error to fix, just execute ./redis-check-aof --fix <filename>.

Except I don't have the smallest idea of where that file is.

I have searched the Github discussions for this issue, but unfortunately none provides me with the location for the file:

  • https://github.com/antirez/redis/issues/4931

The persistence documentation also doesn't make a mention of the location for this file:

  • https://redis.io/topics/persistence

Specs

These are the specs of the system where I am running Redis:

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 16.04.3 LTS
Release:        16.04
Codename:       xenial

Question

Where is located this file?


Solution

You have two choices:

  1. Find the configure file for Redis, normally, it's named redis.conf. The dir and appendfilename configuration specify the directory and file name of the AOF file.
  2. Connect to Redis with redis-cli, and use the CONFIG GET command to get the dir configuration, i.e. CONFIG GET dir. The AOF file should located under this directory.


Answered By - for_stack
Answer Checked By - Willingham (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

Wednesday, July 27, 2022

[FIXED] How to crop images in same dimension W/H (Ubuntu 16)

 July 27, 2022     command-line, crop, image, imagemagick, ubuntu-16.04     No comments   

Issue

I have a lot of images of accommodations and restaurants for my webpage, but each images has different sizes. For example, I have one image of 300x250 and another one of 550x300.

I want to make squares cropping this images from 300x250 to 250x250 and 300x550 to 300x300 for example.

I find some command to crop images with "imagemagic" but I can't crop as square, centered.

I want to make a copy of all my images squared and then resize all to the same size.

I try with this command but I get "No such file or directory" error.

find . -name '*.jpg' -type f -exec bash -c 'convert -define jpeg:size=200x200 ${0%.jpg}  -thumbnail 100x100^ -gravity center -extent 100x100  $0_thumbnail.jpg'  {} \;

Now, I can crop images with this code:

find . -name '*.jpg' -type f -exec bash -c 'convert -define jpeg:size=200x200 $0  -thumbnail 100x100^ -gravity center -extent 100x100  ${0}_thumb.jpg'  {} \;

But cropped image gets this name "X.jpg_thumb.jpg". How can I modify this command to create X_thumb.jpg filename?

[SOLVED] This command solve my problem "%.*"

 find . -name '*.jpg' -type f -printf "%f\n" -exec bash -c 'convert -define jpeg:size=200x200 $0  -thumbnail 100x100^ -gravity center -extent 100x100  ${0%.*}_thumb.jpg'  {} \;

Solution

SOLUTION

find . -name '*.jpg' -type f -printf "%f\n" -exec bash -c 'convert -define jpeg:size=200x200 $0  -thumbnail 100x100^ -gravity center -extent 100x100  ${0%.*}_thumb.jpg'  {} \;


Answered By - Argoitz
Answer Checked By - Katrina (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

Sunday, May 15, 2022

[FIXED] How to restore after accidentally apt-get remove python

 May 15, 2022     apt, python, samba, ubuntu, ubuntu-16.04     No comments   

Issue

Yeah. I've done this. It was stupid.

I did not know it's going to take its dependencies with itself, only wanted to install python 2 and 3 from scratch (because of this problem: https://askubuntu.com/questions/897355/how-to-change-default-idle-for-python).

Now, I can still use my terminal, checked these answers:

https://askubuntu.com/questions/741265/apt-get-remove-python-150mb-apt-get-install-python-687kb

https://askubuntu.com/questions/437644/i-accidentaly-did-sudo-apt-get-remove-python

However after running sudo apt-get install ubuntu-desktop I get these errors:

Setting up python-ldb (2:1.1.24-1ubuntu3) ...
/var/lib/dpkg/info/python-ldb.postinst: 6: /var/lib/dpkg/info/python-ldb.postinst: pycompile: not found
dpkg: error processing package python-ldb (--configure):
 subprocess installed post-installation script returned error exit status 127
No apport report written because MaxReports is reached already
                                                              Setting up python-tdb (1.3.8-2) ...
/var/lib/dpkg/info/python-tdb.postinst: 6: /var/lib/dpkg/info/python-tdb.postinst: pycompile: not found
dpkg: error processing package python-tdb (--configure):
 subprocess installed post-installation script returned error exit status 127
No apport report written because MaxReports is reached already
                                                              dpkg: dependency problems prevent configuration of python-samba:
 python-samba depends on python-crypto; however:
  Package python-crypto is not configured yet.
 python-samba depends on python-ldb (>= 1.1.2~); however:
  Package python-ldb is not configured yet.
 python-samba depends on python-tdb; however:
  Package python-tdb is not configured yet.

dpkg: error processing package python-samba (--configure):
 dependency problems - leaving unconfigured
No apport report written because MaxReports is reached already
                                                              Processing triggers for libc-bin (2.23-0ubuntu7) ...

Errors were encountered while processing:
 mercurial-common
 python-crypto
 python-dnspython
 python-ldb
 python-tdb
 python-samba
E: Sub-process /usr/bin/dpkg returned an error code (1)

Every apt-get install command throws this.

Is there a way to restore these dependencies?


Solution

Hallelujah.

sudo apt-get install --reinstall python python-chardet python-colorama python-distlib python-django python-django-tables2 python-six python-html5lib python-lxml python-minimal python-pkg-resources python-setuptools python-urllib3 python-requests python-pip python-virtualenv

sudo apt-get install --reinstall python-dnspython

sudo apt autoremove

sudo apt-get -f install

After a whole day of adventures in the deepest pits of internet, these commands worked for me.

python-dnspython and samba was still missing after the first command, --reinstall python-dnspython pulled samba in as well. Autoremove removed the needless dependencies.

Naturally some of these could be quite redundant but I was just following some long lost forum posts all over the place and what matters is that it worked.



Answered By - MattSom
Answer Checked By - Marie Seifert (PHPFixing Admin)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

Saturday, May 14, 2022

[FIXED] How to fix "Error: the locale requested by the environment is invalid" during postgresql cluster upgrade (pg_upgradecluster)

 May 14, 2022     locale, postgresql, ubuntu, ubuntu-16.04     No comments   

Issue

After an upgrade from Ubuntu Server 14.04 to 16.04 I had to also upgrade my Postgres clusters from 9.3 to 9.5. The normal way to do that is to first drop the (empty) 9.5 cluster that the upgrade created:

# pg_dropcluster 9.5 main

and then to upgrade the old 9.3 cluster to 9.5:

# pg_upgradecluster 9.3 main

This however results in an error:

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = "en_US.UTF-8",
LC_ALL = (unset),
LC_PAPER = "nl_NL.UTF-8",
LC_ADDRESS = "nl_NL.UTF-8",
LC_MONETARY = "nl_NL.UTF-8",
LC_NUMERIC = "nl_NL.UTF-8",
LC_TELEPHONE = "nl_NL.UTF-8",
LC_IDENTIFICATION = "nl_NL.UTF-8",
LC_MEASUREMENT = "nl_NL.UTF-8",
LC_TIME = "nl_NL.UTF-8",
LC_NAME = "nl_NL.UTF-8",
LANG = "en_US.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to a fallback locale ("en_US.UTF-8").
Error: The locale requested by the environment is invalid.
Error: Could not create target cluster

This means I could not upgrade to Postgres 9.5.

I checked all locale settings:

  • the en_US.UTF-8 locale exists and is properly generated as checked with locale -a (it shows en_US.utf8 in its list)
  • The file /etc/environment contains LC_ALL=en_US.UTF-8 and LANG=en_US.UTF-8
  • /etc/default/locale contains the same setting for LANG, LANGUAGE and LC_ALL
  • I can start Perl without any issue using "perl -e exit"

The error message is generated from the pg_createcluster script which is called from pg_updatecluster. But running pg_createcluster from the command line works just fine, without any issue.

Workaround for the issue:

I used the following workaround to at least get the conversion to work. I edited the /usr/bin/pg_upgradecluster script, as follows:

  • Find the code where it calls pg_createcluster by looking for the comment "create new cluster"
  • That code consists of a series of "push" statements, ending in the suspicious line: delete $ENV{'LC_ALL'}
  • Notice that this LC_ALL is exactly the variable that is unset in the error message.
  • Comment out that delete comment by adding a '#' before it, then save.

This at least circumvents this problem and lets you run the upgrade.

My question: is this a bug in the pg_upgradecluster script, or is something else awry on my system?


Solution

had the same problem on an ubuntu 16.04 server. what helped in my case was to generate all the locales that appear in your listing of $ locale:

$ sudo locale-gen "en_US.UTF-8"
$ sudo locale-gen "nl_NL.UTF-8"

good luck!



Answered By - hiro protagonist
Answer Checked By - David Marino (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

Monday, February 28, 2022

[FIXED] How to install SSL for my website hosted in Azure?

 February 28, 2022     azure, lamp, ssl, ubuntu-16.04     No comments   

Issue

I have hosted my website in Azure. I have created a Virtual Machine on which i have installed LAMP stack as i am using php for my website. I have a sub domain along with the main domain. I want to install SSL for both.

My client has provided me the certificate for SSL installation. I search many Stack overflow post but could not find any post helpful for a beginner like me.

Thanks


Solution

Certificate Installation: Apache 2.4.8+

Under Linux, to check the version number of your Apache server, execute the following command:

apache2ctl -version

or

apachectl -version

Note : If your Apache server's version is less than 2.4.8, please skip this article and go this link

Prerequisites:

Concatenate the CAbundle and the certificate file which we sent you using the following command.

cat domain_com.crt domain_com.ca-bundle > ssl-bundle.crt

If you are Using GUI Text Editor (Ex: Notepad):

(i) To concatenate the certificate files into single bundle file, first open domainname.crt and domainname.ca-bundle files using any text editor.

(ii) Now copy all the content of domainname.crt and paste it on the top of domainname.ca-bundle file.

(iii) Now save the file name as ‘ssl-bundle.crt’.

Configure the Apache server:

  1. Locate the Apache configuration file (example httpd.conf / ssl.conf), the configuration file name can be different depending on your apache version or flavour. Or in a Windows environment (EasyPHP, Wamp, ...) :

C:\Program Files\Apache Software Foundation\Apache X.X\conf\SSL2015 C:\Program Files\Apache Software Foundation\EasyPHP\SSL2015 In a standard installation under Linux, the SSL advanced configuration file is located here:

/etc/apache2/mods-enabled/ssl.conf but it is not in this file that you will activate the certificate for a website. You'll have to edit the file

/etc/apache2/sites-enabled/default-ssl.conf

Use the following command to figure out where Apache is pulling its configuration from:

apache2ctl -V | grep SERVER_CONFIG_FILE or just apachectl -V | grep SERVER_CONFIG_FILE

The situation for ubuntu on Apache differs, as the configurations for 443 and 80 ports for each site are located in separate files. You can find it at /etc/apache2/sites-enabled/ Edit or create the file with the VirtualHost for 443 port to set up the secure connection.

Actually you can duplicate the record for port 80 (should be in your VirtulHost file by default) and change port 80 to port 443. Simply add it below non-secure module.

  1. In the Virtual Host settings for your site, locate the SSL certificate settings section and verify that you have the following 2 directives within the Virtual Host. Please add them in if they are not present:

SSLCertificateKeyFile ( path to the private_key.key file used for the initial generation of the CSR) SSLCertificateFile ( path to the PEM file containing the end entity certificate and the intermediates )

Example VirtualHost Configuration:

DocumentRoot /etc/httpd/htdocs ServerName comodo.com SSLEngine on SSLCertificateFile /usr/local/ssl/crt/ssl-bundle.crt SSLCertificateKeyFile /usr/local/ssl/private/private.key

Note: As with the example above, file names can be domainname.crt, server.key, your server however may use a different naming convention. If you are using a different file location than the example above, you will need to change the paths to match your files on the server.

  1. If you want to enable OCSP Stapling for the website, please add the following directive to the Virtual Host section:

SSLUseStapling on

Also specify OCSP cache response location and size outside of the Virtual Host section using SSLStaplingCache directive:Converting a SSL certificate in Apache to Windows

SSLStaplingCache shmcb:/tmp/stapling_cache(128000)

Note: OSCP Stapling can be configured starting from Apache HTTP server 2.3.3 and later.

  1. After making changes to your config file it is good practice to check the file for syntax errors using "apachectl configtest". The command will return Syntax Ok if there are no errors.

  2. Restart your apache web server:

apachectl stop apachectl start

  1. To verify if you have correctly installed the SSL, please use our SSL Analyzer.

You can check this link.

https://support.comodo.com/index.php?/Knowledgebase/Article/View/1185/0/certificate-installation-apache-248



Answered By - Pradeepta
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] Web server keeps using an old .js-file even after it have been removed/altered

 February 28, 2022     javascript, lamp, ubuntu-16.04     No comments   

Issue

I am using a LAMP stack web server running on Ubuntu 16.04. In my web root directory /public/ I have a few files, but the two important ones concerning my problem are:

  • index.html
  • main.build.js

The web page is a single page application. index.html "opens up" the SPA via the main.build.js, which contains the whole SPA. However, after I made changes to the main.build.js the changes does not apply to the webpage's main.build.js.

What I've tried:

  • Tried multiple browsers
  • I have tried clearing the cache & cookies of my browser(s)
  • Opening up the main.build.js that I made changes to make sure they were there (and they were)
  • Deleting the main.build.js completely (but it still shows up on the webpage!!!)
  • Restarting Apache
  • Restarting the computer

Index.html:

<html lang="en">
  <head>
    <title>BiggerWe (Alpha)</title>
    <meta charset="utf-8">
    <link href='https://fonts.googleapis.com/css?family=Roboto:300,400,500,700|Material+Icons' rel="stylesheet" type="text/css">
    <script src="plotly-latest.min.js"></script>
  </head>
  <body>
    <div id="app">
    </div>
    <script src="main.build.js"></script>
  </body>
</html>

Any tips are welcome. Thanks!


Solution

According to this answered question you need to disable the PageSpeed features of the LMAP Stack and maybe the OPCache feature in php.ini by setting opcache.enable from 1 to 0



Answered By - maik-s
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

Saturday, February 19, 2022

[FIXED] Installing composer programatically working on vagrant but not on EC2 instance

 February 19, 2022     amazon-ec2, ansible, composer-php, ubuntu-16.04, vagrant     No comments   

Issue

I'm working on Ansible playbook. When provisioning on a vagrant machine, it goes well, without errors. Right now I'm on a trouble on the step where composer is installed programatically.

install-composer.sh (This script has been taken from Composer Page)

#!/bin/sh

EXPECTED_SIGNATURE="$(wget -q -O - https://composer.github.io/installer.sig)"
echo $EXPECTED_SIGNATURE;
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
ACTUAL_SIGNATURE="$(php -r "echo hash_file('sha384', 'composer-setup.php');")"
echo $ACTUAL_SIGNATURE; <- Here is empty!

if [ "$EXPECTED_SIGNATURE" != "$ACTUAL_SIGNATURE" ]
then
    >&2 echo 'ERROR: Invalid installer signature'
    rm composer-setup.php
    exit 1
fi

php composer-setup.php --quiet
RESULT=$?
rm composer-setup.php
exit $RESULT

The EC2 is a Ubuntu 16.04 instance, on vagrant as well.

Playbook task where i'm getting the error:

 - name: Download Composer
      script: scripts/install_composer.sh
      register: composer_setup
      #when: not composer_stat.stat.exists
      tags:
        - deploy

And the full error with --verbose:

TASK [Download Composer] ******************************************************* fatal: [18.203.185.87]: FAILED! => {"changed": true, "failed": true, "rc": 1, "stderr": "Shared connection to 18.203.185.87 closed.\r\n", "stdout": "a5c698ffe4b8e849a443b120cd5ba38043260d5c4023dbf93e1558871f1f07f58274fc6f4c93bcfd858c6bd0775cd8d1\r\n/home/ubuntu/.ansible/tmp/ansible-tmp-1566333565.4-174304924088429/install_composer.sh: 5: /home/ubuntu/.ansible/tmp/ansible-tmp-1566333565.4-174304924088429/install_composer.sh: php: not found\r\n/home/ubuntu/.ansible/tmp/ansible-tmp-1566333565.4-174304924088429/install_composer.sh: 6: /home/ubuntu/.ansible/tmp/ansible-tmp-1566333565.4-174304924088429/install_composer.sh: php: not found\r\n\r\nERROR: Invalid installer signature\r\nrm: cannot remove 'composer-setup.php': No such file or directory\r\n", "stdout_lines": ["a5c698ffe4b8e849a443b120cd5ba38043260d5c4023dbf93e1558871f1f07f58274fc6f4c93bcfd858c6bd0775cd8d1", "/home/ubuntu/.ansible/tmp/ansible-tmp-1566333565.4-174304924088429/install_composer.sh: 5: /home/ubuntu/.ansible/tmp/ansible-tmp-1566333565.4-174304924088429/install_composer.sh: php: not found", "/home/ubuntu/.ansible/tmp/ansible-tmp-1566333565.4-174304924088429/install_composer.sh: 6: /home/ubuntu/.ansible/tmp/ansible-tmp-1566333565.4-174304924088429/install_composer.sh: php: not found", "", "ERROR: Invalid installer signature", "rm: cannot remove 'composer-setup.php': No such file or directory"]} changed:

[192.168.33.10] => {"changed": true, "rc": 0, "stderr": "Shared connection to 192.168.33.10 closed.\r\n", "stdout":

"a5c698ffe4b8e849a443b120cd5ba38043260d5c4023dbf93e1558871f1f07f58274fc6f4c93bcfd858c6bd0775cd8d1\r\na5c698ffe4b8e849a443b120cd5ba38043260d5c4023dbf93e1558871f1f07f58274fc6f4c93bcfd858c6bd0775cd8d1\r\n", "stdout_lines": ["a5c698ffe4b8e849a443b120cd5ba38043260d5c4023dbf93e1558871f1f07f58274fc6f4c93bcfd858c6bd0775cd8d1", "a5c698ffe4b8e849a443b120cd5ba38043260d5c4023dbf93e1558871f1f07f58274fc6f4c93bcfd858c6bd0775cd8d1"]}

Any idea why this line is returning empty on ec2?

"$(php -r "echo hash_file('sha384', 'composer-setup.php');")"

Thanks!


Solution

After Trying what Aaron Said, I saw that php was not correctly installed(not installed at all)

I was executing:

ansible-playbook ansible/playbook.yml -i ansible/hosts.ini -t deploy --ask-vault-pass --verbose

Note the tag deploy, so in here it is suposed that php was installed. All had to do was remove -t deploy from my command!



Answered By - Albeis
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

Wednesday, February 9, 2022

[FIXED] phpMyAdmin - Error Incorrect format parameter

 February 09, 2022     mysql, php, phpmyadmin, ubuntu-16.04, xampp     No comments   

Issue

I tried to import a large sql file but its not getting imported. And it shows the following error.

phpMyAdmin - Error Incorrect format parameter

I have been using Xampp-php 5.6 in ubuntu16.04.

I have tried these links given below already but none of it worked.

https://www.webtrickshome.com/forum/how-to-fix-phpmyadmin-error-incorrect-format-parameter-that-appeared-while-importing-a-database

importing db phpMyAdmin - Error Incorrect format parameter

Importing large database file in MAMP phpMyAdmin


Solution

You can easily import using cmd promt

mysql -u username(of phpmyadmin) -p database_name < file_path/file_name.sql

you can also do the changes in php.ini file to increase upload size of phpmyadmin.

in php.ini of your PHP installation (note: depending if you want it for CLI, Apache, or Nginx, find the right php.ini to manipulate)

post_max_size=500M

upload_max_filesize=500M

memory_limit=900M

or set other values.

Restart/reload apache if you have apache installed or php-fpm for nginx if you use nginx.

Remote server?

increase max_execution_time as well, as it will take time to upload the file.

NGINX installation?

you will have to add: client_max_body_size 912M; in /etc/nginx/nginx.conf to the http{...} block



Answered By - Sayed Mohd Ali
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

Friday, January 28, 2022

[FIXED] How do I resolve "PHP Fatal error: Unknown: Failed opening required"

 January 28, 2022     .htaccess, php, ubuntu-16.04, ubuntu-server, wordpress     No comments   

Issue

I have two sites on a LAMP stack. One (Site1) uses WordPress with Wordfence, and it works perfectly fine. The second website (Site2) only runs a simple index.php file on it:

<?php
echo "Testing";
?>

However, it shows HTTP ERROR 500 with the error log as below.

[Thu Dec 22 16:23:44.774993 2016] [:error] [pid 56607] [client xxx:27253] PHP Warning:  Unknown: failed to open stream: No such file or directory in Unknown on line 0
[Thu Dec 22 16:23:44.775042 2016] [:error] [pid 56607] [client xxx:27253] PHP Fatal error:  Unknown: Failed opening required '/var/www/site1/public_html/public/wordfence-waf.php' (include_path='.:/usr/share/php') in Unknown on line 0

Site1 and Site2 have nothing to do with each other, and they are located in separate folders. I am not sure what's happening. Please advise.

.htaccess file on Site1

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

# Wordfence WAF
<IfModule mod_php7.c>
        php_value auto_prepend_file '/var/www/site1/public_html/public/wordfence-waf.php'
</IfModule>
<Files ".user.ini">
<IfModule mod_authz_core.c>
        Require all denied
</IfModule>
<IfModule !mod_authz_core.c>
        Order deny,allow
        Deny from all
</IfModule>
</Files>

# END Wordfence WAF

Solution

Thanks for @EdCottrell. I finally found an answer for that.

First, I debug to find where the php.ini locates by create a info.php on the working site.

<? php phpinfo(); ?>

Then, I find if there is any value on auto_prepend_file =. If yes, delete it.

Then I open the site1.conf file and add the auto_prepend_file line instead of the one from .htaccess

<Directory "/path/to/folder">
    php_value auto_prepend_file /absolute/path/to/apache-prepend.php
</Directory>

After restarting the Apache server, everything works again!

sudo systemctl restart apache2


Answered By - Dale Nguyen
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

Monday, January 3, 2022

[FIXED] Inserting special characters to mysql database

 January 03, 2022     lamp, mysql, ssh, ubuntu-16.04     No comments   

Issue

I am building a basic web application which searches through a mysql database using a simple php script to retrieve results based on a few checkboxes on the page, everything is working except the database handling.

The problem seems to be happening when i try to fill my database, i have a few thousand entries but here's a single example.
The input:
INSERT INTO example_database.test_table (testcolumn) values ("LÆRER");
Seems to run without a problem, but when i try to select all items from the table it gets returned without the "Æ" character
In console i get;>"LRER", In the web browser the character is presented as �, "L�RER"
I have tried altering both the database and table specifically for UTF-8 with no luck.
NOTE: The lowercase equivalent "æ" DOES work.
I am running a LAMP stack on Ubuntu 16.04.
mysql -V and php -v;

mysql  Ver 14.14 Distrib 5.7.30, for Linux (x86_64) using  EditLine wrapper
PHP 7.0.33-0ubuntu0.16.04.14 (cli) ( NTS )

EDIT:
I have come to a diagnosis of sorts, after "opening" or entering mysql> the console stops recognizing the character upon input, at least it doesn't display anything as having been input. Still no idea how to fix it though.


Solution

Ended up figuring it out, it was an issue with the MySQL "shell"(?)/client not accepting the characters. I ended up making a separate page on my site with just a simple textbox input that I populated my tables with, after which everything worked fine. This isn't really a solution to the actual problem, but more of a workaround.



Answered By - joachimf
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Older Posts Home
View mobile version

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
All Comments
Atom
All Comments

Copyright © PHPFixing