I need to install PEAR on a server which does not have outsite access to the net. There is no go-pear.bat in the php folder and even if it had go-pear.bat i think it needs access to the net.
I looked an the Installing PEAR from a local copy from the PEAR website. But it needs PEAR to be already installed for it to work.
So do any of you guys know how to install PEAR without access to internet?
You don't need PEAR installed on the webhost, just on your local machine.
The two main approches are
Track your dependencies manually, and copy all the appropriate files to the server yourself
With pear installed on your local machine, do pear install -R/my/root_dir -a PEAR. This will install the PEAR package and all dependencies to the specified root directory. Copy this installation to your webhost.
I think it's possible to use pear to manage an installation via FTP also. I never tried.
You should also have a look at "pear help" and "pear help install".
There is a way to do this if you are on Windows and have the PHP installer.
You can select, during the PHP installation time, the PEAR option under extension menu when selecting the components for PHP installation in order to install PEAR package.
If you already have PHP installed, you just have to click on the installer to choose "modify", and choose the correct option.
http://lh4.ggpht.com/_SDci0Pf3tzU/SgBXLClDWEI/AAAAAAAAEuI/TgnBA_SEHFs/s400/pear%20install.jpg
I wrote an article on this very subject:
http://christian.roy.name/blog/install-pear-without-network-no-internet-accessoffline
It will allow you to use the pear command as well.
Create temporary folder that I will get ride of later.
mkdir pear-temp
cd pear-temp
Upload all the PEAR packages to that temp folder (using SFTP, FTP, Whatever).
If you use a USB key, then you copy them all like this:
cp /mnt/usb/*.tgz ./
Extract the core packages in a separate folder.
mkdir lib
tar x -C lib -zf PEAR-*.tgz
tar x -C lib -zf Console_Getopt-*.tgz
tar x -C lib -zf Archive_Tar-*.tgz
tar x -C lib -zf Structures_Graph-*.tgz
This bash function is to be able to set the include_path joined by colons.
function join() {
local IFS=$1
shift
echo "$*"
}
pear requires output buffering and needs to load all the core packages from the lib folder.
PHPOPT="-d output_buffering=1 -d include_path=.:$(join ':' lib/*)"
First we setup our configuration file.
php $PHPOPT lib/PEAR-*/scripts/pearcmd.php config-create $HOME/ $HOME/.pearrc
Now we install ALL our packages. Make sure you have all the required dependencies as well.
php $PHPOPT lib/PEAR-*/scripts/pearcmd.php install -o -O *.tgz
Cleanup
cd ..
rm -Rf pear-temp
Put pear in your path:
PATH="$PATH:$HOME/pear"
Edit your .profile or .bashrc if you want this to be permanent.
Edit your php.ini too or add it using set_include_path() function, whichever :)
Drink to sucess!
Related
I am running windows 10 with the ubuntu subsystem installed as my localhost. I have composer installed on that and when I try to install the yii2 basic application it goes through the process correctly but when i open the yii2 basic application in my browser I get:
Failed to change permissions for directory "/mnt/c/Users/andre/zype/staff-tools/web/assets/89851207": chmod(): Operation not permitted
If I then change permissions on the yii2 installation file structure with
sudo chown -R www-data:www-data .
the application loads but the web/assets folders are missing so my application has no styling. I am unsure if this is a composer issue or a yii2 issue but it looks like permissions to me.
Try changing the permission of 'assets' folder most likely to 777 (all users can access this file)
your-project/web/assets
Well this solution works for Linux users. Will require to check for windows
Follow Steps
Step 1- Install Composer (I installed it through bash)
Step 2- Now in cmd use following command
composer create-project --prefer-dist yiisoft/yii2-app-basic yii2-basic-check
Output (Last Lines)-
chmod('runtime', 0777)...done.
chmod('web/assets', 0777)...done.
chmod('yii', 0755)...done.
Step 3 - Open "http://localhost/yii2-basic-check/web/" URL in browser.
It worked fine for me
Important: Windows Subsystem for Linux has many serious problems with file permission. So, I advise not to install Linux programs and it's files in Windows drives i.e. DRVFS (/mnt/c). Also as PHP frameworks need many files, it will be better if you install distributions in another internal NTFS drives other that C:\ drive.
Steps: Place/clone the required project files/repositories in current user's home folder e.g. /root, /home, /home/user. Do not place the files in C:\ drive aka. /mnt/c otherwise WSL will not follow their permissions correctly. Here is an example of the installation procedure from YiiFramework: The Definitive Guide to Yii 2.0.
Install required packages: sudo apt-get install php php-cli php-common php-mbstring php-xml php-zip zip unzip
Go to user folder: cd ~
Download composer: curl -sS https://getcomposer.org/installer | php
Install yii2-basic: ~/composer.phar create-project --prefer-dist yiisoft/yii2-app-basic basic
Go to project folder: cd ~/basic
Run PHP server: php yii serve
Open server in browser at localhost:8080 (default port 8080).
I want to use php spreadsheet package and from their site, I was told to install composer on cpanel but have met little success on the internet trying to figure out how to do it.
Please, who can put me through on how to install composer on liveserver
You can use SSH for this (alternatively using cron jobs to run the commands will also work - way more tedious)
Login to your cPanel account via SSH
Make directory for your composer (can also be used for other executables that you might store)
mkdir ~/composer
cd ~/composer
Download composer
wget https://getcomposer.org/download/1.6.5/composer.phar
Change the name of composer and make it executable
mv composer{.phar,}
chmod +x composer
You will now be able to call composer by
php ~/composer/composer install
But it's more convenient to have it run by just invoking composer in your terminal. For this add the ~/composer directory to your $PATH. I'm using VIM for text editing so
vim ~/.bashrc
Append those two lines at the bottom
PATH=~/composer:$PATH
export PATH
Exit and login via SSH again - you will be able to freely call composer in your terminal
I am a new programmer and I need your help.
I'm pretty much new to Atom editor, but setup some nice packages like Atom Beautify. After using it in a html / php file I'm getting the error "Could not find 'php-cs-fixer' . The program may not be installed. The strange thing is, I did install the package php-cs-fixer but nothing happens.
My system is Windows.
Anyone got an idea how I can fix this?
You must have installed "php" usually when installing the Wamp or Xampp servers are installed by default.
Download the file "php-cs-fixer.phar" https://github.com/FriendsOfPHP/PHP-CS-Fixer
In the CMD execute this command: php where.exe
You get a path, that path copy in: Open Atom Packages / Atom Beautify / Settings / Executables / PHP
In the same folder where the php.exe is located copy the file "php-cs-fixer.phar"
Redo the previous process with the CMD and the Atom in PHP-CS-Fixer "
Just run this command in terminal, then it will work perfectly:
$ composer global require friendsofphp/php-cs-fixer
Everything will be fixed!
I am not sure about in Windows, but on Mac and Linux, I do the following. You may be able to do this with Git Bash in Windows.
Install php-cs-fixer with Homebrew (via PHP-CS-Fixer Instructions)
brew install php-cs-fixer
Confirm php-cs-fixer was installed
which php-cs-fixer
its because you need to install php cs fixer, the atom extension is trying to use it but its not currently installed on your system, install it here:
https://github.com/FriendsOfPHP/PHP-CS-Fixer
I suggest you install manually the php-cs-fixer using the following steps:
You can use yum, apt, and other methods of installing a software or a .exe for windows
Get the path to the installed binary, for example for me i checked using whereis php-cs-fixer and I got /usr/bin/php-cs-fixer
Go to Packages > Atom Beautify > Settings > Executables > PHP-CS-FIXER then in the Binary/Script Path give the path of the php-cs-fixer above (/usr/bin/php-cs-fixer)
Enjoy beautify.
The issue for me was originally installing with composer. Composer does not put a .phar file into the /bin folder.
Download the .phar file (https://github.com/FriendsOfPHP/PHP-CS-Fixer#locally) and place it somewhere explicitly, then put that location in settings->executables->PHP-CS-Fixer path
The manual way did work for me and this how I went about it;
I download php-cs-fixer manually.
$ wget https://cs.symfony.com/download/php-cs-fixer-v3.phar -O php-cs-fixer
or with curl
$ curl -L https://cs.symfony.com/download/php-cs-fixer-v3.phar -o php-cs-fixer
Then I fixed the rights and moved it to the right directory.
$ sudo chmod a+x php-cs-fixer
$ sudo mv php-cs-fixer /usr/local/bin/php-cs-fixer
Finally, I ran php-cs-fixer and it worked.
full link
make an empty folder somewhere. example: C:\Programs\php-cs-fixer
run composer require friendsofphp/php-cs-fixer
open atom and go to
settings -> packages -> atom beautify -> settings -> executables ->
php cs fixer input the path there:
C:\Programs\php-cs-fixer\vendor\bin\php-cs-fixer.bat
optionally:
add C:\Programs\php-cs-fixer\vendor\bin to windows env path so you
can use it from cli
I'm trying to get the PHP Core SDK to work without composer. There doesn't seem to be a simple way of working with the SDK without composer (https://github.com/paypal/sdk-core-php)
Any chance someone has an autoloader script or another solution to get this working?
I've been scanning for other information throughout the web, but it seems i'm the only person alive trying to get this to work without Composer.
Any chance? Thanks!
Alright, so it seems that i am really the only person on this planet who wants to do this. Well, then i'll answer my question myself. It seems like this is the guide for running every composer package without composer. Yihaa \o/. Probably easy stuff for most people using composer, but i've never used it because i'm on a shitty windows shared-host.
This is based on debian, but replace every apt-get with YUM for redhat or whatever.
So, i'm doing this in my root directory, don't whine about it :)
Ssh into your Linux Box (local mac or windows will work aswell but i'm not telling you)
# cd into the root directory (or user directory)
cd ~/
# install php5 and php5-curl and unzip (because the package we're
# getting is from GitHub). There might be other stuff your package is asking for.
# So just include it at the end
apt-get install php-5 php5-curl unzip
# install composer
curl -sS https://getcomposer.org/installer | php
# get the master archive
wget https://github.com/paypal/sdk-core-php/archive/master.zip
# unzip it
unzip master.zip
# cd into the directory
cd master
# move the files back to the ~/ directory
mv * ..
# remove the master directory
rm -r master
# install package using composer
php composer.phar install
# now we have the lib directory and the vendor directory. Lets tar that up
tar -cf package.tar lib/ vendor/
#we now have a tar file called package.tar copy that to your computer, ftp, whatever.
You can now create a directory in the place where you include all your stuff called lib-package (or whatever fancy name you'd like to call it) and add the following line in your project
require_once(/path/to/your/package/lib-package/vendor/autoload.php)
Voila, you're done.
PHP API using: https://github.com/sandeepshetty/shopify_api
I have PHP 5.3.27 installed
I installed Composer (by going to
the website and using their install.exe)
It mentions that
"This will download shopify_api into the
vendor/sandeepshetty/shopify_api directory."
But I do not see the folders or files anywhere on the computer.
The plugin author is saying that if you download Composer with the instructions he provided (via Terminal), then Composer will autoload those files for you. Unfortunately, though easier, simply going to the source URL for the Composer tool won't do that for you.
First, make sure you have created the composer.json file and stored it in your project directory. Then, log into your server or system via the command line (Terminal for Mac OS, Putty for Windows). Cd into your project directory, and install by entering these commands:
$ curl -s http://getcomposer.org/installer | php
$ php composer.phar install