Composer needs a proxy to install laravel apparently, where do I get that? can I set it up myself using apache? - apache

I was trying to get started with Laravel just last night, so I tried to install it with composer but it wouldn't go through and kept sayin The "https://packagist.org/packages.json" file could not be downloaded: SSL operation failed with code 1. , so I looked around and found out that you need to tell composer to use a proxy.(q1 q2 q3).
Well now this might sound silly but honestly I had no idea what a proxy was until last night, so I went and studied it a bit and I got this far:
"Proxy means to act on behalf of another. In the context of a Web server, this means
one server fetching content from another server, then returning it to the client"
and apparently there's 2 kinds of proxy: forward proxy and reverse proxy.
In those 3 pages that I just showed, they were saying before runing php bin\composer global require "laravel/installer=~1.1" you have to set an env var like this: set http_proxy=username:password#proxy_server:port
So now my question is: I still don't know where can I get a proxy like that, should I set it up myself with apache? is that gonna even work? what do I do?
Your thoughts would be appreciated, thank you.
Edit: Environment info:
I'm on windows 7
installed xampp-win32-5.6.14-0-VC11-installer
all of those 5 important extensions are all enabled in phpinfo()
the path= C:\Users\UserName\AppData\Roaming\Composer\vendor\bin is set in environment variables
here's a picture of the whole error
here's the result of php -m i.stack.imgur.com/wz030.png
Some stuff that I tried:
I went into these sites: proxy4free.com us-proxy.org proxylist.hidemyass.com ultraproxies.com,
I tried this: set https_proxy=https://xteamweb.com:xteam#75.55.165.86:8088 and this one: set http_proxy=http://1proxy.space and many others from those sites: i.stack.imgur.com/6YWyp.png
but no matter what, this is the result of all of them: i.stack.imgur.com/mqOrP.png
Still nothing...

Ok here's the solution, if you're having the same problem:
1:
Make sure these are all uncommented in php.ini:
extension=php_openssl.dll
extension=php_curl.dll
extension=php_sockets.dll
extension_dir="E:\xampp\php\ext"
browscap="E:\xampp\php\extras\browscap.ini"
Add these 2 lines at the end of php.ini
curl.cainfo=c:\openssl-1.0.2d-win32\ssl\cert.pem
openssl.cafile=c:\openssl-1.0.2d-win32\ssl\cert.pem
2:
Run this: php -r "print_r(openssl_get_cert_locations());"
and you'll get:
Array
(
[default_cert_file] => c:/openssl-1.0.2d-win32/ssl/cert.pem
[default_cert_file_env] => SSL_CERT_FILE
[default_cert_dir] => c:/openssl-1.0.2d-win32/ssl/certs
[default_cert_dir_env] => SSL_CERT_DIR
[default_private_dir] => c:/openssl-1.0.2d-win32/ssl/private
[default_default_cert_area] => c:/openssl-1.0.2d-win32/ssl
[ini_cafile] => c:\openssl-1.0.2d-win32\ssl\cert.pem
[ini_capath] =>
)
3:
Make these folders:
c:\openssl-1.0.2d-win32
c:\openssl-1.0.2d-win32\ssl
c:\openssl-1.0.2d-win32\ssl\certs
c:\openssl-1.0.2d-win32\ssl\private
Download this: http://curl.haxx.se/ca/cacert.pem.
Rename it to cert.pem and put it in c:\openssl-1.0.2d-win32\ssl\.
Rename it to cert.crt and put it in c:\openssl-1.0.2d-win32\ssl\certs\.
So:
c:\openssl-1.0.2d-win32\ssl\cert.pem
c:\openssl-1.0.2d-win32\ssl\certs\cert.crt
4:
Download https://getcomposer.org/Composer-Setup.exe and install it, It will no longer gives u the ERR_CONNECTION error.
Go to c:\users\YOURUSERNAME.
composer.bat should be there, if not create it yourself.
Add c:\users\YOURUSERNAME to your path.
Edit composer.bat and delete what's in it and put this in #php "%~dp0composer.phar" %*.
Download https://getcomposer.org/composer.phar.
Place composer.phar in c:\users\YOURUSERNAME.
5:
Done.
Composer will now install laravel using: composer global require "laravel/installer=~1.1" with no problem.
(Plus: now composer command is available globally instead of using it like: php composer.phar or php bin\composer).

Related

Expo application doesn't get changes in .env file

I have an Expo managed react native application. I created my .env file in the root of my project, installed react-native-dotenv and set up babel to use it. After a while I managed to get it to work.
I have my environment variable
ENDPOINT=http://127.0.0.1:8000/api
and i use it with
process.env.ENDPOINT
After a while I decided to test the android version of the app, so i changed the endpoint url to my LAN ip and restarted the server. The problem is that even after restarting the server, the cache and the computer, when I call process.env.ENDPOINT it keeps the first url I set.
Here's a list of the things i tried:
restarting the server
restarting the server and the cache
restarting the whole computer
change the variable name to REACT_APP_ENDPOINT as many suggested (I get undefined, it's still stuck to ENDPOINT)
empty expo cache
The strange thing is that I already changed that same variable twice (from 127.0.0.1:8000 to 127.0.0.1:8080 and back for a problem with backend) and had the same problem, but it went away by itself after a couple of minutes (and server restarts).
This time I've been trying to get it to work for 7 hours and nothing has changed.
Any idea?
I had the same issue and managed to run the app with .env changes after using the following command.
expo r -c
reference: https://github.com/goatandsheep/react-native-dotenv/issues/75#issuecomment-728055969
After a couple hundred more tests I gave up and implemented a "custom" solution, without any external library:
Switched .env files to TypeScript files (E.g. .env.development -> env.development.ts)
Set up an object named env that has all environmental variables as properties
export const env = {
VAR1: 'foo',
...
}
Imported this constant inside the application entry point (in my case App.tsx)
Inside the main constructor assign env to global.env
Use global.env instead of process.env
Not sure if this is the best practice, but solved my problem for now, works like a charm and doesn't require me to reload my application at every change. I'm a bit concerned by the security aspect of having the environment in a global variable inside a js project, so any suggestion is still welcome

How to debug neovim lsp custom command

I am attempting to get the volar vue language server to work in place of vetur for neovim's native lsp.
Using both lspconfig and lspinstall I was able to create a working custom install for sumneko_lua (unrelated but had to manually build due to some issues with the built-in :LspInstall lua). Below is that code duplicated and modified for an attempt at using this new vue server:
local vue_config = require'lspinstall/util'.extract_config('vuels')
vue_config.default_config.cmd = {'node', './node_modules/vscode-vue-languageservice/out/index.js', '--stdio'}
require'lspinstall/servers'.newvue = vim.tbl_extend('error', vue_config, {
install_script = [[
! test -f package.json && npm init -y --scope=lspinstall || true
npm install vscode-vue-languageservice#latest
]],
uninstall_script = nil
})
Running :LspInstall newvue installs properly, however :LspInfo shows this language server is attached to the buffer (of a .vue file) but not active. I believe the issue is with this path: ./node_modules/vscode-vue-languageservice/out/index.js. It exists, but may not be the correct entry point? The default vue ls simply has vls as the command because it provides a binary. Am I missing something in this package? I have yet to come across another language server without a single binary to pick out.
Thanks!
Can you try an absolute path to the out.js file? In my pretty elaborate config for a custom Volar install I'm using something just /home/myuser/dev/volar/packages/server/out/index.js (where the volar folder is just the whole volar cloned github repo). My full config is here
I don't think you can use relative paths like you did. I know you're assuming that the "./node_modules" means "workspace directory" but it's hard to tell in which directory nvim-lspconfig opens up those executables.
I have yet to come across another language server without a single binary to pick out.
Volar also provides a binary, it's volar-server (after running npm i -g #volar/server), it's just with a custom install (ie. alongside the real volar) you can't use it, because I assume you want to use your local install with custom code.
As for more indepth debugging/logging, you can check ~/.cache/nvim/lsp.log to see why the language server dies in detail.

Parsoid: Unexpected Token error and failing to initialize

mwApis:
- # This is the only required parameter,
# the URL of you MediaWiki API endpoint.
uri: 'http://spgenerations.com/wiki/api.php'
On my linux box, I can curl this URL and receive the api data.
Regardless of using the apt-get installation or developer installation (ngm install) both instances give me this error:
{"name":"parsoid","hostname":"play.projecttidal.com.KVM","pid":12636,"level":30,"levelPath":"info/service-runner","msg":"master(12636) initializing 2 workers","time":"2019-03-12T03:55:47.504Z","v":0}
{"name":"parsoid","hostname":"play.projecttidal.com.KVM","pid":12645,"level":60,"moduleName":"lib/index.js","levelPath":"fatal/service-runner/worker","msg":"Unexpected token ...","time":"2019-03-12T03:55:47.917Z","v":0}
{"name":"parsoid","hostname":"play.projecttidal.com.KVM","pid":12636,"level":40,"message":"first worker died during startup, continue startup","worker_pid":12645,"exit_code":1,"startup_attempt":1,"levelPath":"warn/service-runner/master","msg":"first worker died during startup, continue startup","time":"2019-03-12T03:55:48.925Z","v":0}
For context, the hostname here is incorrect and the domain has been removed.
This is my parsoid config:
// Parsoid configuration
$wgVirtualRestConfig['modules']['parsoid'] = array(
'url' => 'server.spgenerations.com',
'forwardCookies' => true
);
I have tried everything under the hidden voodoo sun to get this thing to work and I'm beyond frustrated. 4 hours spent tinkering with URL links to no avail, so please, if you know anything relating to this error, lend a hand.
Check what Node.JS version you are running with:
nodejs --version
If it is 4.x: That's too old for Parsoid. I had the same situation (Debian 9, still such an old Node.JS version in the repositories..). After upgrading to 10.x it ran fine for me.
I used the following guide (see Install using a PPA) to update to a newer Node.JS release: https://www.digitalocean.com/community/tutorials/how-to-install-node-js-on-debian-9

Yii 2.0 showing Warning: Module 'mysql' already loaded in Unknown on line 0

I am new to yii 2.0. I installed my first Yii2.o application on my server and configred URL to use user friendly urls. However, I am getting
Warning: Module 'mysql' already loaded in Unknown on line 0
message when I go to the web/about/ URL. I tried to remove the base rout using "defaultRoute" in web.php but that is also not possible.
Please help me to figure out this issue.
That has nothing to do with Yii 2.0. It's a PHP misconfiguration.
Probably, you've enabled mysql extension twice. Search in your php.ini and extensions ini files:
extension=mysql.so
or
extension=mysql.dll
I had the same problem and i fix it by deleting this line in my php.ini:
extension=mysql.so
located in: /etc/php5/apache2/ and restarting apache2 service:
sudo service apache2 restart

enchant_broker_init() performance issue

I have a web site which uses enchant enchant_broker_init().
I`m not sure why but enchant_broker_init() takes something like 19~ seconds to load the page.
Once I remove this function page loads right away.
anyone has an idea why this is? or how can I debug it?
Thanks
Steps to install php enchant plugin.
APACHE
http://apache.mivzakim.net//httpd/binaries/win32/#warnings
PHP
http://windows.php.net/download/
ENABLE PHP ON APACHE
http://php.net/manual/en/install.windows.apache2.php
Enchant will not work using WAMP. ( at least for it hasn't... ).
Afterwards add the following path
share\myspell\dicts
to your PHP directory.
should look like that.
C:\PHP\share\myspell\dicts
Put the dictionary files there.
.aff
.dic