Updating PHP in fedora Instance on AMAZON EC2 - php

I have a fedora Instance runnig in an Amazon EC2. The problem is, I have a php already installed, but I want to update (PS: Somebody already gave to me the instance with the php installed). When I try the command: yum update php an error message appears.
Setting up Update Process
Setting up repositories
Cannot find a valid baseurl for repo: updates-released
Error: Cannot find a valid baseurl for repo: updates-released
I tried to uncomment the baseurl line in the yum repositorie files, but a new error appears.
Setting up Update Process
Setting up repositories
http://download.fedora.redhat.com/pub/fedora/linux/core/updates/4/i386/repodata/repomd.xml: [Errno 4] IOError: <urlopen error (-2, 'Name or service not known')>
Trying other mirror.
Cannot open/read repomd.xml file for repository: updates-released
failure: repodata/repomd.xml from updates-released: [Errno 256] No more mirrors to try.
Error: failure: repodata/repomd.xml from updates-released: [Errno 256] No more mirrors to try.

The error that you are getting sounds like it's a connection or DNS related issue -- see if you can ping 'download.fedora.redhat.com,' then see if you can use wget to attempt to get the file.
Also, your /etc/yum.repos.d/ directory may contain a repository file with an invalid repository in it -- I'm not sure if they're still publishing updates for Fedora 4 (it was released around 2004ish). Your best bet is to make sure that the version in /etc/fedora-release matches with the version in that repository configuration file.

Related

Best way to update PHP version on bedrock wordpress site

I updated the language of my question, because the original question seemed to be worded in a confusing way (evident from downvotes and unhelpful comments). Hope this makes more sense.
Hi, I'm trying to upgrade the PHP version on a site, I followed this thread and it worked nicely on my development site - I basically changed all instance of PHP "7.1" in the trellis directory to "7.4", and required a PHP version of at least 7.4 in composer and ran composer update.
I happily pushed the update to the staging site, but when I attempted to provision the server with ansible-playbook server.yml -e env=staging, I received the following error:
TASK [Install Python 2.x] ************************************************************************************* ***********************************
System info:
Ansible 2.3.0.0; Linux
Trellis at "Update PHP from 7.1 to 7.4"
---------------------------------------------------
Shared connection to 107.170.41.149 closed.
fatal: [107.170.41.149]: FAILED! => {"changed": false, "failed": true, "rc": 100, "stderr": "Shared connection to 107.170.41.149 closed.\r\n", "stdout": "/usr/bin/python\r\nE: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).\r\n", "stdout_lines": ["/usr/bin/python", "E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution)."]}
Ansible seems to be getting stuck on the "Install Python 2." task. The staging server cannot be provisioned, and when I run php -v on the server it says it's running PHP 7.2.
How do I update PHP? I am avoiding doing it manually, because my gut's telling me there's a special roots way.
The server in question is Ubuntu 16.04 running PHP 7.2 (as mentioned above).
Below is the verbose output of the error from provisioning the staging server:
System info:
Ansible 2.3.0.0; Linux
Trellis at "Update PHP from 7.1 to 7.4"
---------------------------------------------------
OpenSSH_7.6p1 Ubuntu-4, OpenSSL 1.0.2n 7 Dec 2017
debug1: Reading configuration data /home/jill/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: auto-mux: Trying existing master
debug2: fd 3 setting O_NONBLOCK
debug2: mux_client_hello_exchange: master version 4
debug3: mux_client_forwards: request forwardings: 0 local, 0 remote
debug3: mux_client_request_session: entering
debug3: mux_client_request_alive: entering
debug3: mux_client_request_alive: done pid = 16490
debug3: mux_client_request_session: session request sent
debug1: mux_client_request_session: master session id: 2
debug3: mux_client_read_packet: read header failed: Broken pipe
debug2: Received exit status from master 100
Shared connection to 107.170.41.149 closed.
fatal: [107.170.41.149]: FAILED! => {
"changed": false,
"failed": true,
"rc": 100,
"stderr": "OpenSSH_7.6p1 Ubuntu-4, OpenSSL 1.0.2n 7 Dec 2017\r\ndebug1: Reading configuration data /home/jill/.ssh/config\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 19: Applying options for *\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: done pid = 16490\r\ndebug3: mux_client_request_session: session request sent\r\ndebug1: mux_client_request_session: master session id: 2\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 100\r\nShared connection to 107.170.41.149 closed.\r\n",
"stdout": "/usr/bin/python\r\nE: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).\r\n",
"stdout_lines": [
"/usr/bin/python",
"E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution)."
]
}
This is neither a PHP composer nor a Python problem nor an Ansible problem. The underlying operating system (Ubuntu) has a problem with its apt libraries. The error comes from APT. Sadly you didn't tell us, what ansible module you use in the task named "Install Python 2.x".
Try 'apt-get -f install' with no packages
I think, some package installations hang on the system and need to be installed or configured. This may not have anything to do with your current job of upgrading PHP. Something went wrong in the past. APT will continue to stop operating til this issue is solved. Normally you would do it manually and have a look at the output of apt-get -f install to get an advice of what is the problem with that system. I think it will try to fix the issue automatically or throw an error what is the real issue (for example with two packages that cannot be installed at the same time or a file or directory that is missing or contains wrong values).
This is nothing "normal" which should happen all the time, when you update 100 hosts. This is very specific and part of the so called "configuration gap". Of course -if you dont want to login manually- you can ignore that error in your playbook task, but register the result, if the task failes, check, if the error messages in the registered var contains the above message in stderr and call a command module in your playbook. This would be a little bit of "self-healing".
Something like this
- package:
name: "..."
ignore_errors: true
register: installation
- shell: "apt -f install"
register: self_healing
when:
- "installation is failed"
- "'apt -f install' in installation.stderr"
- debug:
var: self_healing
when: "self_healing is defined"

Running Rscript from within PHP: cannot load shared libraries

I am trying to run R code from within PHP. I am using RHEL 7.4.
However, because Apache runs as a different user than installed the R packages, it cannot load packages:
My PHP code has this line:
echo shell_exec("(Rscript -e 'library(lme4, lib.loc = \"/var/www/R/lib\")')2>&1");
which produces this error in the browser:
Error: package or namespace load failed for 'lme4' in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/var/www/R/lib/Rcpp/libs/Rcpp.so':
/var/www/R/lib/Rcpp/libs/Rcpp.so: failed to map segment from shared object: Permission denied
Execution halted
The file /var/www/R/lib/Rcpp/libs/Rcpp.so has permissions 775, so I don't think the permissions are actually the problem.
How can I tell Apache / PHP where to look for the shared libraries?
The server is not public-facing, so I would take any solution from properly accessing the shared library, to giving user apache sudo access with NOPASSWD to run as my user (or something similarly reckless, since that didn't actually work...).
Thank you!
This appears due in part to an SELinux setting in Red Hat. I'm not entirely sure whether this is Red Hat-centric, or specific to the configuration at my university (who installed Red Hat in the first place).
Originally:
$ getenforce
Enforcing
Fix:
$ sudo setenforce 0
$ getenforce
Permissive
Persistent fix: modify /etc/selinux/config to have the line
SELINUX=Permissive
Credit to this StackOverflow thread.

Deploying existing local project to Bluemix BuildPack error

I hope someone can help me out with this issue I'm facing.
I've made a fully functional project on a local server and would now like to deploy it to Bluemix Cloud Foundry.
I've followed the tutorial: https://console.eu-gb.bluemix.net/docs/starters/upload_app.html
But when I'm trying to push it through terminal with following commands
cf push app_name -b https://github.com/cloudfoundry/php-buildpack.git -s cflinuxfs2
cf push app_name -b https://github.com/cloudfoundry/go-buildpack
cf push app_name -c start_command
cf push app_name -m 512m
But non seems to work, since every single time I get the following error
Staging failed: Buildpack compilation step failed
-----> Composer command failed
FAILED
Error restarting application: BuildpackCompileFailed
It is a PHP app build with PHPStorm on Symfony and Doctrine if that matters.
I am fairly new to all server/setup/deployment configurations as well as command line.
EDIT 1
I figured out this part thanks to this link: https://support.run.pivotal.io/entries/109600943-cf-push-ing-a-symfony-app-fails-with-Composer-command-failed-
It seems that by default the buildpack assumes that you want all of the files you push to be public. Because of this assumption, it takes all of your files and moves them into the doc root of either HTTPD or Nginx.
By creating the file .bp-config/options.json in the root of your project. Then inside options.json add
{
"WEBDIR": "web"
}
This will tell the buildpack that you have a specific directory to use for the doc root, so it will just use that instead of moving everything into the default doc root.
However...
This brings me a new issue and returns the following error
FAILED
Error restarting application: Start unsuccessful
If i enter the recent log the terminal provides me this:
2016-08-25T02:53:40.62+0200 [App/0] OUT Could not open input file: app.php
2016-08-25T02:53:40.62+0200 [App/0] ERR
2016-08-25T02:53:40.69+0200 [DEA/211] ERR Instance (index 0) failed to start accepting connections
2016-08-25T02:53:40.72+0200 [API/9] OUT App instance exited with guid abb206b3-b8ea-4269-b248-ec7b35f7098a payload: {"cc_partition"=>"default", "droplet"=>"abb206b3-b8ea-4269-b248-ec7b35f7098a", "version"=>"b6c3c871-5484-4f12-9d84-657cf6eacfbf", "instance"=>"c11566bdabe5458d9bfc4965c9c1aa85", "index"=>0, "reason"=>"CRASHED", "exit_status"=>1, "exit_description"=>"failed to accept connections within health check timeout", "crash_timestamp"=>1472086420}
2016-08-25T02:53:40.72+0200 [API/3] OUT App instance exited with guid abb206b3-b8ea-4269-b248-ec7b35f7098a payload: {"cc_partition"=>"default", "droplet"=>"abb206b3-b8ea-4269-b248-ec7b35f7098a", "version"=>"b6c3c871-5484-4f12-9d84-657cf6eacfbf", "instance"=>"c11566bdabe5458d9bfc4965c9c1aa85", "index"=>0, "reason"=>"CRASHED", "exit_status"=>1, "exit_description"=>"failed to accept connections within health check timeout", "crash_timestamp"=>1472086420}
2016-08-24T16:41:14.03+0200 [DEA/135] OUT Starting app instance (index 0) with guid abb206b3-b8ea-4269-b248-ec7b35f7098a
2016-08-24T16:41:26.26+0200 [App/0] ERR bash: start_command: command not found
2016-08-24T16:41:26.26+0200 [App/0] OUT
2016-08-24T16:41:26.35+0200 [DEA/135] ERR Instance (index 0) failed to start accepting connections
2016-08-24T16:41:26.38+0200 [API/6] OUT App instance exited with guid abb206b3-b8ea-4269-b248-ec7b35f7098a payload: {"cc_partition"=>"default", "droplet"=>"abb206b3-b8ea-4269-b248-ec7b35f7098a", "version"=>"5ebd6d77-68c4-4901-b9a8-b5cecfa4cddb", "instance"=>"7b5b555ae68645f4a2c09b73c0adbcb3", "index"=>0, "reason"=>"CRASHED", "exit_status"=>127, "exit_description"=>"failed to accept connections within health check timeout", "crash_timestamp"=>1472049686}
EDIT 2 (updated error msg)

How to deploy Laravel 5.1 application to CentOS 6.4 VPS (or any!) server (PHP 5.5.32)

I have a Laravel 5.1 application that I'm trying to deploy on my CentOS 6.4 VPS server. The problem is that I am getting Error 500 when trying to load the page. When I check the error log it shows me this:
PHP Fatal error: Uncaught exception 'UnexpectedValueException' with message 'The stream or file "/home/pams/pams_todo_list/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied' in /home/pams/pams_todo_list/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:87
I have changed the permissions in pams_todo_list/storage and pams_todo_list/vendors to 777 instead of 755 as a test, but no love.
This problem has been solved, thanks to FFForever and lagbox on the Laravel IRC channel.
My owner permissions were wrong. I had inadvertently uploaded the project using the root account. The fix was two fold. First, I setup suPHP as my php handler (I do have root access to this server) through the EasyApache3 UI in WHM. Then I set the owner:
chown -R pams:pams pams_todo_list
Now it works. I cannot say if it would have worked without setting up suPHP, however it was strongly recommended to set that up, so I did.

phabricator on redhat's openshift

I installed phabricator on openshift using a quickstart from github
https://github.com/CodeBlock/phabricator-openshift-quickstart
I got it running up fine, but I now have two issues:
1.) A setup issue that says apc.stat is enabled and that must be disabled in
/var/lib/openshift/my-user-hash/php/configuration/etc/php.ini
however I cannot access that with sudo command(sudo permission denied), even if I open it normally, I didn't find any apc.stat settings in the php.ini
2.) I can't figure out how set the local path for tracking repositories for diffusion. It says
I must give a path which should be read-writable by phabricator, I tried to give the persistent storage location ..data/ , but it gives me an exception as follows :
Unhandled Exception ("CommandException")
Command failed with error #1!
COMMAND
(cd '../data/' && HOME='/var/lib/openshift/my-user-hash/app-root/runtime/repo/phabricator/support/empty/' git cat-file --batch)
STDOUT
(empty)
STDERR
sh: line 0: cd: ../data/: No such file or directory
how do I fix this?
1) According to Num Duong answer, it seems like u currently could not resolve this issue, probably u should wait for openshift php.ini permissions policy changes.
Anyway this is minor non blocking issue.
2) Modify config file and re-deploy to openshift.
Look for available phabricator options here
U need smth like this: 'repository.default-local-path' => getenv('OPENSHIFT_DATA_DIR'),
P.S. Anyway there is one particular issue with phabricator on openshift that possibly never got resolved: cloning git repositories from OpenShift instances into Phabricator do not
work by SSH, due to permissions regarding the ssh configuration.

Categories