Today I wanted to launch my old Symfony flex based project (I have removed the docker containers/images/cache locally some time ago).
When launching the container, in the entry point, composer is supposed to install all dependencies, but it fails.
I've launched the project without installing dependencies, so I could run it manually, and a strange thing happens.
Composer is unable to download the recipes index.json file, while I can do it with curl.
Here are composer logs:
# composer update symfony/flex
In CurlDownloader.php line 623:
The "https://raw.githubusercontent.com/symfony/recipes-contrib/flex/main/index.json" file could not be downloaded (HTTP/2 404 )
update [--with WITH] [--prefer-source] [--prefer-dist] [--prefer-install PREFER-INSTALL] [--dry-run] [--dev] [--no-dev] [--lock] [--no-install] [--no-audit] [--audit-format AUDIT-FORMAT] [--no-autoloader] [--no-suggest] [--no-progress] [-w|--with-dependencies] [-W|--with-all-dependencies] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--apcu-autoloader-prefix APCU-AUTOLOADER-PREFIX] [--ignore-platform-req IGNORE-PLATFORM-REQ] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [-i|--interactive] [--root-reqs] [--] [<packages>...]
And here's curl:
# curl -IL --http2 https://raw.githubusercontent.com/symfony/recipes/flex/main/index.json
HTTP/2 200
cache-control: max-age=300
content-security-policy: default-src 'none'; style-src 'unsafe-inline'; sandbox
content-type: text/plain; charset=utf-8
etag: "cbf7d5d470e448beeb667739f56cc627eb271aa54de7d1a46d10eb8ee72ddc36"
strict-transport-security: max-age=31536000
x-content-type-options: nosniff
x-frame-options: deny
x-xss-protection: 1; mode=block
x-github-request-id: D29A:D902:9C967E:ACDA5B:63B2C9F7
accept-ranges: bytes
date: Mon, 02 Jan 2023 13:47:19 GMT
via: 1.1 varnish
x-served-by: cache-fra-eddf8230085-FRA
x-cache: HIT
x-cache-hits: 1
x-timer: S1672667240.634749,VS0,VE1
vary: Authorization,Accept-Encoding,Origin
access-control-allow-origin: *
x-fastly-request-id: aac3282f232b3395c82294f6b70b799be6586a24
expires: Mon, 02 Jan 2023 13:52:19 GMT
source-age: 74
content-length: 73467
I ran the composer diagnose command:
# composer diagnose
Checking composer.json: WARNING
require.symfony/one-signal-notifier : exact version constraints (6.1.x-dev) should be avoided if the package follows semantic versioning
Checking platform settings: OK
Checking git settings: OK git version 2.38.2
Checking http connectivity to packagist: OK
Checking https connectivity to packagist: OK
Checking github.com oauth access: The oauth token for github.com seems invalid, run "composer config --global --unset github-oauth.github.com" to remove it
Checking disk free space: OK
Checking pubkeys: FAIL
Missing pubkey for tags verification
Missing pubkey for dev verification
Run composer self-update --update-keys to set them up
Checking composer version: OK
Composer version: 2.5.1
PHP version: 8.1.13
PHP binary path: /usr/local/bin/php
OpenSSL version: OpenSSL 3.0.7 1 Nov 2022
cURL version: 7.86.0 libz 1.2.13 ssl OpenSSL/3.0.7
zip: extension present, unzip present, 7-Zip not available
TL;DR
Check if you have a custom authentication configured for github/gitlab or other services in your project. It may be outdated and could cause the above issue. In my case, it was configured in auth.json file.
Story mode:
I've noticed the The oauth token for github.com seems invalid, run "composer config --global --unset github-oauth.github.com" to remove it. It was the only clue I had.
I've tried running the composer config --global --unset github-oauth.github.com command but it changed nothing, so I've ignored it.
After a while, trying to figure it out (and running composer install on a server) I noticed an auth.json file added to the repository. It seems that the file contained an outdated GitHub OAuth key required by a custom package we used to use some time ago.
Since then our PR was merged into the official package and our version was no longer used, but we didn't remove the old auth.json file.
EDIT:
Now in Github, you have the ability to generate fine-grained tokens with an expiration date of up to 1 year.
Related
The website is in Laravel 5.2.45 with Postgres.
The old VPS configuration is CentOs 7 with PHP 7.0, nginx/1.20.1, Composer version 1.9.0, PostgreSQL
psql --version
psql (PostgreSQL) 9.2.24
.
The new VPS configuration is CentOs 7 with PHP 7.1, nginx/1.20.1, Composer version 2.2.12, PostgreSQL
psql --version
psql (PostgreSQL) 14.2
After making a transfer of the files using ()
rsync -avz /srv/www/ root#host:/srv/www
For the database transfer, "pg_dump" is used to back up the old database, and "pg_restore" is used to restore to the new database. The scripts are
pg_dump -F t old_db > old_db.tar
pg_restore --dbname=new_db --verbose old_db.tar
I dare to upgrade from PostgreSQL version 9 to 14 based on this article:
The pg_restore can take a database backed up in the older version and restore it in the newer version.
Successfully updated composer, done with firewall-cmd, SeLinux setup
semanage fcontext -a -t httpd_sys_content_t '/srv/www(/.*)?'
restorecon -Rv /srv/www
after these setups, the website is accessible fine. But when I try to log in (admin or user) or sign up, I'm getting
This page isn’t working
www.domain.com is currently unable to handle this request.
HTTP ERROR 500
In the Nginx access_log, getting the following response
[19/Apr/2022:06:52:35 +0000] "POST /login HTTP/2.0" 500 0 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36"
There is neither entry for this event in Nginx error_log, nor anything in the Laravel_log
If anyone knows the reason behind this behavior. Please, I need your appreciable guide to solve this.
Appendix:
-> I have also installed and set the pgadmin4 with apache on a distinct port xxxxxx on the new VPS.
-> The old server is still intact and is able to get the website fine for all things.
-> Don't think composer version mismatch could be the reason.
Check your config.php in
bootstrap/cache
for any data mismatch and old data from old server. you can easily update config.php to current new state.
I've been using DDEV for around 2 weeks with no issues using custom local domain names which was all working nicely until yesterday where one of my projects crashed.
Upon restarting DDEV, when trying to go to any custom local domain e.g dash.myproject.com, it results in a 500 nginx error.
If I go to ip address https://127.0.0.1:56248
My browser auto resolved to http://
and I get:
400 Bad Request
The plain HTTP request was sent to HTTPS port
nginx
If I manually update the ip address (https://127.0.0.1:56248) with the prefix https in the browser again, it brings back my local site.
My DDEV config for the project:
name: DashboardV2
type: laravel
docroot: public
php_version: "7.4"
webserver_type: nginx-fpm
router_http_port: "80"
router_https_port: "443"
xdebug_enabled: false
additional_hostnames:
- dash.myproject.local
additional_fqdns:
- dash.myproject.local
mariadb_version: "10.2"
mysql_version: ""
provider: default
use_dns_when_possible: false
composer_version: ""
Please would someone be able to help me resolve this?
I even get the same issue for new projects like I tried with the example project:
ddev poweroff && mkdir ~/tmp/testddev && cd ~/tmp/testddev && ddev config --project-type=php && ddev start
https://ddev.readthedocs.io/en/stable/users/troubleshooting/
(Added an index file for the above, resolves on 127.0.0.1:port but get 500 nginx error)
If I ddev logs, here are the results for the server, not seeing a 500 error reference though:
+ set -o errexit nounset pipefail
+ rm -f /tmp/healthy
+ DDEV_PHP_VERSION=7.4
+ DDEV_WEBSERVER_TYPE=nginx-fpm
+ '[' -n 7.4 ']'
+ update-alternatives --set php /usr/bin/php7.4
update-alternatives: using /usr/bin/php7.4 to provide /usr/bin/php (php) in manual mode
update-alternatives: warning: skip creation of /usr/share/man/man1/php.1.gz because associated file /usr/share/man/man1/php7.4.1.gz (of link group php) doesn't exist
+ ln -sf /usr/sbin/php-fpm7.4 /usr/sbin/php-fpm
+ export PHP_INI=/etc/php/7.4/fpm/php.ini
+ PHP_INI=/etc/php/7.4/fpm/php.ini
+ '[' '!' -z ']'
+ '[' -d /mnt/ddev_config/php ']'
+ '[' laravel = backdrop ']'
++ id -un
++ id -gn
+ printf '\nexport APACHE_RUN_USER=ryan\nexport APACHE_RUN_GROUP=dialout\n'
+ a2enmod access_compat alias auth_basic authn_core authn_file authz_core authz_host authz_user autoindex deflate dir env filter mime mpm_prefork negotiation reqtimeout rewrite setenvif status
Considering dependency authn_core for access_compat:
Module authn_core already enabled
Module access_compat already enabled
Module alias already enabled
Considering dependency authn_core for auth_basic:
Module authn_core already enabled
Module auth_basic already enabled
Module authn_core already enabled
Module authn_file already enabled
Module authz_core already enabled
Considering dependency authz_core for authz_host:
Module authz_core already enabled
Module authz_host already enabled
Considering dependency authz_core for authz_user:
Module authz_core already enabled
Module authz_user already enabled
Module autoindex already enabled
Considering dependency filter for deflate:
Module filter already enabled
Module deflate already enabled
Module dir already enabled
Module env already enabled
Module filter already enabled
Module mime already enabled
Considering conflict mpm_event for mpm_prefork:
Considering conflict mpm_worker for mpm_prefork:
Enabling module mpm_prefork.
Module negotiation already enabled
Module reqtimeout already enabled
Enabling module rewrite.
Module setenvif already enabled
Module status already enabled
To activate the new configuration, you need to run:
service apache2 restart
+ a2enconf charset localized-error-pages other-vhosts-access-log security serve-cgi-bin
Conf charset already enabled
Conf localized-error-pages already enabled
Conf other-vhosts-access-log already enabled
Conf security already enabled
Conf serve-cgi-bin already enabled
+ '[' nginx-fpm = apache-fpm ']'
+ '[' false = true ']'
+ disable_xdebug
Disabled xdebug
+ ls /var/www/html
+ sudo mkdir -p /mnt/ddev-global-cache/terminus/cache /mnt/ddev-global-cache/ddev-live
+ sudo mkdir -p /mnt/ddev-global-cache/bashhistory/DashboardV2-web
++ id -u
++ id -g
+ sudo chown -R 501:20 /mnt/ddev-global-cache/ /home/ryan/.ssh /home/ryan/.drush /home/ryan/.gitconfig /home/ryan/.my.cnf
+ '[' -d /mnt/ddev_config/.homeadditions ']'
+ cp -r /mnt/ddev_config/.homeadditions/. /home/ryan/
+ '[' -d /mnt/ddev_config/homeadditions ']'
+ cp -r /mnt/ddev_config/homeadditions/. /home/ryan/
+ sudo mkdir -p /mnt/ddev-global-cache/mkcert
+ sudo chmod -R ugo+rw /mnt/ddev-global-cache/mkcert
+ mkcert -install
Using the local CA at "/mnt/ddev-global-cache/mkcert" ✨
The local CA is now installed in the system trust store! ⚡️
+ sudo CAROOT=/mnt/ddev-global-cache/mkcert mkcert -cert-file /etc/ssl/certs/master.crt -key-file /etc/ssl/certs/master.key dashboardv2.ddev.site dash.reviews.local dash.reviews.local.ddev.site localhost 127.0.0.1 127.0.0.1 web ddev-DashboardV2-web ddev-DashboardV2-web.ddev_default
Using the local CA at "/mnt/ddev-global-cache/mkcert" ✨
Created a new certificate valid for the following names 📜
- "dashboardv2.ddev.site"
- "dash.reviews.local"
- "dash.reviews.local.ddev.site"
- "localhost"
- "127.0.0.1"
- "127.0.0.1"
- "web"
- "ddev-DashboardV2-web"
- "ddev-DashboardV2-web.ddev_default"
The certificate is at "/etc/ssl/certs/master.crt" and the key at "/etc/ssl/certs/master.key" ✅
+ sudo chown 501 /etc/ssl/certs/master.crt /etc/ssl/certs/master.key
Server started
+ echo 'Server started'
+ exec /usr/bin/supervisord -n -c /etc/supervisor/supervisord-nginx-fpm.conf
2021-03-26 13:31:15,767 INFO Included extra file "/etc/supervisor/php-fpm.conf" during parsing
2021-03-26 13:31:15,767 INFO Included extra file "/etc/supervisor/conf.d/mailhog.conf" during parsing
2021-03-26 13:31:15,767 INFO Included extra file "/etc/supervisor/conf.d/supervisor.conf" during parsing
2021-03-26 13:31:15,768 INFO supervisord started with pid 1
2021-03-26 13:31:16,775 INFO spawned: 'child_exit_monitor' with pid 1644
2021-03-26 13:31:16,776 INFO spawned: 'php-fpm' with pid 1645
2021-03-26 13:31:16,776 INFO spawned: 'nginx' with pid 1646
2021-03-26 13:31:16,777 INFO spawned: 'mailhog' with pid 1647
[26-Mar-2021 13:31:16] NOTICE: fpm is running, pid 1645
[26-Mar-2021 13:31:16] NOTICE: ready to handle connections
[26-Mar-2021 13:31:16] NOTICE: systemd monitor interval set to 10000ms
2021-03-26 13:31:17,812 INFO success: child_exit_monitor entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2021-03-26 13:31:17,812 INFO success: php-fpm entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2021-03-26 13:31:17,812 INFO success: nginx entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2021-03-26 13:31:17,812 INFO success: mailhog entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2021/03/26 13:39:05 [info] 1652#1652: *20 client sent plain HTTP request to HTTPS port while reading client request headers, client: 172.18.0.1, server: _, request: "GET /login HTTP/1.1", host: "127.0.0.1:56248"
2021/03/26 13:39:05 [info] 1652#1652: *21 client sent plain HTTP request to HTTPS port while reading client request headers, client: 172.18.0.1, server: _, request: "GET /favicon.ico HTTP/1.1", host: "127.0.0.1:56248", referrer: "http://127.0.0.1:56248/login"
2021/03/26 13:40:03 [info] 1652#1652: *18 client timed out (110: Connection timed out) while waiting for request, client: 172.18.0.1, server: 0.0.0.0:443
2021/03/26 13:41:27 [info] 1652#1652: *31 client sent plain HTTP request to HTTPS port while reading client request headers, client: 172.18.0.1, server: _, request: "GET /login HTTP/1.1", host: "127.0.0.1:56248"
2021/03/26 13:41:27 [info] 1652#1652: *32 client sent plain HTTP request to HTTPS port while reading client request headers, client: 172.18.0.1, server: _, request: "GET /favicon.ico HTTP/1.1", host: "127.0.0.1:56248", referrer: "http://127.0.0.1:56248/login"
I am on MacOS m1 BigSur and Docker is running 3.3.0 (62029).
Please let me know if you need to see further information.
Edit 2021-04-13: The current Docker Desktop Tech Preview for Apple M1 (RC3) works fine with ddev.
I have no .htaccess file. I have index.php which has the following content and works beautifully in a browser like Chrome, or Safari:
<?php print "hello world"; ?>
When I load it in a browser I get: hello world.
When I try any of the following I get ERROR 500: Internal Server Error.
/usr/bin/wget http://example.com/index.php
/usr/bin/wget -nv -t 5 --connect-timeout=4 -w 4 --connect-timeout=20 -nd --no-cache --no-cookies http://example.com/index.pp
/usr/bin/wget --content-on-error http://example.com/index.php
/usr/bin/wget --header="Accept: text/html" --user-agent="Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:21.0) Gecko/20100101 Firefox/21.0"
curl http://example.com/index.php
I checked all apache log files and can see nothing there at all except for when I load it in a webrowser.
This is Ubuntu 16.04 php7.0 Apache2. All freshly installed and updated and the laest version as of Nov 3rd 2016
I tried reinstalling wget. I tried wget from other machines and the local machine.
I have tried putting varnish on port 80 and apache on port 8080 behind varnish... that didn't change anything.
Wget outpus the following with debug:
root#one:~# wget --debug http://example.com/index.php
DEBUG output created by Wget 1.17.1 on linux-gnu.
Reading HSTS entries from /root/.wget-hsts
URI encoding = ‘UTF-8’
--2016-11-03 07:51:27-- http://example.com/index.php
Resolving example.com (example.com)... 207.158.37.70
Caching example.com =207.158.37.70
Connecting to example.com (example.com)|207.158.37.70|:80... connected.
Created socket 3.
Releasing 0x0000561eeda0d190 (new refcount 1).
---request begin---
GET /index.php HTTP/1.1
User-Agent: Wget/1.17.1 (linux-gnu)
Accept: */*
Accept-Encoding: identity
Host: example.com
Connection: Keep-Alive
---request end---
HTTP request sent, awaiting response...
---response begin---
HTTP/1.1 500 Internal Server Error
Server: Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.20 OpenSSL/1.0.1f mod_perl/2.0.8 Perl/v5.18.2
Content-Type: text/html; charset=iso-8859-1
Content-Length: 538
Accept-Ranges: bytes
Date: Thu, 03 Nov 2016 14:49:42 GMT
X-Varnish: 2177415129
Age: 0
Via: 1.1 varnish
Connection: keep-alive
---response end---
500 Internal Server Error
Registered socket 3 for persistent reuse.
URI content encoding = ‘iso-8859-1’
Skipping 538 bytes of body: [<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>500 Internal Server Error</title>
</head><body>
<h1>Internal Server Error</h1>
<p>The server encountered an internal error or
misconfiguration and was unable to complete
your request.</p>
<p>Please contact the server administrator at
voztechnologies#gmail.com to inform them of the time this error occurred,
and the actions you performed just before this error.</p>
<p>More information about this error may be available
in the server erroSkipping 26 bytes of body: [r log.</p>
</body></html>
] done.
2016-11-03 07:51:27 ERROR 500: Internal Server Error.
Saving HSTS entries to /root/.wget-hsts
root#one:~#
It can happen that your apache is not accepting any useragent from curl or wget. This can be configured from httpd.conf file (or may be some other place, not have much experience on that).
If you use the useragent of your browser with wget or curl, it should work with you. For example:
wget -U "Opera 11.0" http://www.test.com/
curl -A "Opera 11.0" http://www.test.com/
I noticed another domain name on the server worked. So, I copied the vhost, reloaded apache and it still was not working. I made everything exact. In the end I saw DNS was pointed to my dev server which was not listening for my domain name and returning an error 500.
Updated DNS and the show is back on. Thanks for working me through things with ideas!
I have run the below commands and put the source code into /var/www/html directory.
sudo add-apt-repository ppa:ondrej/php5-5.6
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install php5
sudo apt-get install php5-curl
sudo apt-get install apache2
sudo service apache2 restart
I have followed the below link for configuring the Varnish to cache the webpages.
But how do i know whether its cached or not. Everytime I open the webpage its showing the same webpage. How to set expiry for it.
I need to cache the webpage for 2 minutes and then expire, so where do I it set those duration.
https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-varnish-with-apache-on-ubuntu-12-04--3
This is what i get when I say
curl -I http://localhost
HTTP/1.1 200 OK
Server: Apache/2.4.18 (Ubuntu)
ETag: "dd6d718cc03aac91085163fd1927f07a-gzip"
Vary: Accept-Encoding
Content-Type: text/html; charset=UTF-8
Date: Wed, 03 Feb 2016 13:17:48 GMT
X-Varnish: 1965452251 1965452250
Age: 13
Via: 1.1 varnish
Connection: keep-alive
You can tell if varnish is caching the page by looking at the HTTP headers returned from the request. The varnish request will have Age: <seconds> appended as a header to tell you the age of the request.
Via: 1.1 varnish-plus-v3
Via: 1.1 varnish-plus-v3
Age: 170
You can tell varnish how long to cache the response (if the proper cache headers aren't set on the response itself) by setting the beresp.ttl value in the configuration file in vcl_backend_response (or vcl_fetch iirc, depending on your varnish version):
set beresp.ttl = 120s;
You can test this by doing
watch HEAD http://localhost:6081
which will repeat the HEAD request to show the headers from the URL every two seconds by default. You'll see Age: increasing until it crosses 120s, when the resource will be returned for the last time and expired from the cache (which means that you can see Age: 122 even if it is set to 120s).
Test it with a value shorter than 120s to see it expire quicker.
Attempting to access:
mydomain.name/info.php
Error Log:
2016/01/01 18:23:00 [crit] 15592#0: *1 connect() to unix:/var/run/php5-fpm.sock failed (13: Permission denied) while
connecting to upstream, client: censoredipaddress1, server:
censoredipaddress2, request: "GET /info.php HTTP/1.1", upstream:
"fastcgi://unix:/var/run/php5-fpm.sock:", host: "censoredipaddress3"
Censored addresses:
1: test home computer ip address
2: ipaddress to nginx VPS
3: domain name
NGinx (installed from source code with RTMP module added)
Customizations: basic_auth, RTMP
Ref. 1A: https://obsproject.com/forum/resources/how-to-set-up-your-own-private-rtmp-server-using-nginx.50/
Linux EngineX MySQL PHP (on Ubuntu 15 x64)
Ref. 2A: https://www.digitalocean.com/community/tutorials/how-to-install-linux-nginx-mysql-php-lemp-stack-on-ubuntu-14-04
<<< MISC NOTES/COMMENTS >>>
I noticed that source builds of NGinx, the actual file path to html is /usr/local/nginx/html and folders called "websites_enabled" or the like do not exist (as far as I know).
When using (i did NOT use this to install nginx because it does not allow me to easily add RTMP, If I have to do it this way then please explain how to install RTMP this way)
apt-get install nginx
the websites_enabled file structure is present and so are the expected /usr/shared and /www directories.
I tried some other fixes which made me include some stuffs like www-data but I am not using www-data (i think that is used when my html file is found in www/)
I'm trying to add PHP to my RTMP streaming capabilities and since I am unable to install RTMP using apt-get install nginx I will need help installing RTMP if I am forced to use apt-get install nginx to be able to use php.
Thank You In Advance!