Getting PHP composer to work with XAMPP on Arch Linux behind a corporate proxy (goal: install Laravel)
It took me quite some tests until I finally found a way to get all those things working together:
- Arch Linux
- Laravel (PHP framework)
- behind corporate proxy server (Squid)
So, in a nutshell, the necessary actions were:
I'm working on an updated Arch Linux with no PHP, Apache, Composer whatsoever installed by means of Pacman as my goal is to run everything out of the XAMPP box.
Corporate proxy server
I have exported the variables http_proxy and https_proxy as I'm captured behind a proxy server on my work:
export http_proxy=<proxy-ip>:<proxy-port> export https_proxy=<proxy-ip>:<proxy-port>
So no protocol prefixes for me (http://, https://), simply the plain IP addresses and port numbers.
Download and install XAMPP for Linux:https://www.apachefriends.org/download.html
Usually, this will reside under /opt/lampp after this.
Strangely, there was no cert.pem to be found in my /opt/lampp/share/openssl/ directory, even though this ought to be the case, according to
php -r "print_r(openssl_get_cert_locations());"
So I downloaded this certificate file manually from http://curl.haxx.se/ca/cacert.pem and saved it in this directory under the name "cert.pem".
Environment variable HTTPS_PROXY_REQUEST_FULLURI
I read a lot about these two environment variables:
But I definitely had to unset / delete them to prevent errors.
In order to find the PHP executable on the system, I appended "/opt/lampp/bin" to the exported PATH variable. I did this globally in /etc/profile.
Composer can be downloaded and installed into the XAMPP bin directory like so:
curl -sS https://getcomposer.org/installer | php -- --install-dir=/opt/lampp/bin --filename=composer
As this bin directory is already visible through the PATH variable, PHP and composer are now directly accessible from the command line.
Composer, Laravel and the tricky part
Officially, Laravel can be installed with this command:
composer create-project laravel/laravel --prefer-dist
To get a very verbose output, you can add the option "-vvv" after the composer command. At first, I had an awful lot of problems with this step. But having found out and done all the previous steps at last, I was able to download Laravel.