I have a PHP command-line tool that I'm trying to distribute via a pear channel.
Installing the binary itself is no problem.
What I'm looking for is a way to install it's associated bash completion file, which should go in /etc/bash_completion.d/.
No, it's not possible to install files to arbitrary locations with PEAR.
You could write a post-install script which copies an installed file into /etc/bash_completion.d/, though.
I found that you can define custom file roles, which would seem to be the right way to go about this:
http://pear.php.net/manual/en/guide.migrating.customroles.defining.php
Related
I've created tool, that runs as a server, and allow clients to connect to it through TCP, and run some commands. It's written on python 3
Now I'm going to build package and upload it to Pypi, and have conceptual problem.
This tool have python client library inside, so, after installation of the package, it'll be possible to just import library into python script, and use for connection to the daemon without dealing with raw TCP/IP.
Also, I have PHP library, for connection to me server, and the problem is - I don't know how to include it into my python package the right way.
Variants, that I found and can't choose the right one:
Just include library.php file into package, and after running "pip install my_package", I would write "require('/usr/lib/python3/dist-packages/my_package/library.php')" into my php file. This way allows to distribute library with the server, and update it synchronously, but add long ugly paths to php require instruction.
As library.php in placed on github repository, I could just publish it's url in the docs, and it'll be possible to just clone repository. It makes possible to clone repo, and update library by git pull.
Create separate package with my library.php, upload it into packagist, and use composer to download it when it's needed. Good for all composer users, and allow manual update, but doens't update with server's package.
Maybe I've missed some other variants.
I want to know what would be true python'ic and php'ic way to do this. Thanks.
I've decided to create separate PHP package for my PHP library, and upload it to a packagist.org, so, user could get it using php composer, but not forced to, as it would be in case of including library.php into python package.
I am currently working on a project that would automate the installation of various environments we have within the company. I have several packages created using Chocolatey.
The problem that I am having is creating a dynamic custom installation file. The current internal website allows for users to checkmark the software they wish to install. The idea would be to then allow them to click an install button which would generate an .exe file. The .exe would run the command line scripts to install the Chocolatey packages.
An example of the command line after marking the Google Chrome and Notepad++ boxes would be:
> choco install googlechrome
> choco install notepadplusplus.install
I am wondering what would be the best way to go about creating an .exe file dynamically.
Two examples I am getting inspiration from would be:
https://ninite.com/
http://getbootstrap.com/customize/
There is a chrome extension that does something similar. You may want to explore what it is doing and change it for your needs. It's called Chocolate Factory.
I'm trying to fix a bug in a more complex PEAR package (CodeCoverage). So I'd like to have the development version that exists not within my PEAR path:
c:\Programme\PHP\PEAR\PHP
with one on another location, here exemplary:
c:\Dokumente und Einstellungen\hakre\PhpstormProjects\php-code-coverage\PHP\
Is there a common way in PEAR to temporarily switch from the installed package to just the files on another location of the disk?
I tried with placing a symbolic link, but that does not work because I need to link CodeCoverage.php as well which is not possible on Windows XP.
Is there some kind of development switch for this kind of scenario in PEAR or is it just that it's the business of each package to take care of that?
I'm using the CodeCoverage package together with PHPUnit.
I could get it to work by adding it to PHP's include path before the PEAR dir:
include_path = ".;c:\path\to\php-code-coverage;C:\programme\php\pear"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Invoking PHPUnit now uses the standard package but the development version of CodeCoverage. No symbolic linking required, editing php.ini is enough.
The "Contributing" section of the PHPUnit github project has a runner script included to make that task easier for you.
You can ether check out all the repositories from there or, if you only need one, still use the runner script:
#!/bin/bash
php -d include_path='.:../phpunit/:../dbunit/:../php-code-coverage/:../php-file-iterator/:../php-invoker/:../php-text-template/:../php-timer:../php-token-stream:../phpunit-mock-objects/:../phpunit-selenium/:../phpunit-story/:/usr/local/lib/php' ../phpunit/phpunit.php $*
(intentially not formatted as code so the whole thing is shown)
You can adapt the pathes to an absolute one by replacing .. with /path/to/your/dev/folder/ and put the script in /usr/local/bin/ and call it phpunit-dev.
Then it will automatically pick up all the existing folders and fall back to the pear path at the end for everything it can't find.
Another way to get a dev setup quickly would be to install it from composer with minimum-stability: dev and change the remote on one of the repos :)
I am developing a Facebook app using heroku. My app needs the ability to upload files (pictures) to a folder on a remote server, and I assume ftp is the best option. Unfortunately the ftp extension is not enabled out of the box. I spoke with support and they suggested the following:
"We unfortunately don't support FTP, or any PHP extension at this moment.
But the good news is that we just open sourced our PHP build pack, so you could try to vendor it yourself:
https://github.com/heroku/heroku-buildpack-php"
So I am assuming I can follow the readme instructions in the link above, and simply include the --enable-ftp option?
This is a bit beyond my current knowledge. I really appreciate the help, and look forward to learning something new.
I had to do something similar. Here's what I did:
1.You need to use a custom buildpack which installs the pear packages Net_FTP. I suggest that you fork the one I've been using (https://github.com/antonyevans/heroku-buildpack-php/)
Then you need to change bin/compile. Key changes are the removal of the lines (around 163):
php/bin/pear install mail
php/bin/pear install Net_SMTP
And the addition of Net_FTP extension:
php/bin/pear install Net_FTP
2.Then you need to tell your application to load the package:
require_once 'Net_FTP.php';
Your biggest problem is that the Heroku file system is emphemeral. I would suggest going back and looking at your architecture again.
I am new to Linux and I am attempting to install the PHP PEAR library on a virtual server which is running Ubuntu. I am following a tutorial that covers installing PEAR but have run up against an area where I am confused. When running the PEAR installation program I am prompted as to what I want the INSTALL_PREFIX to be. Evidently the INSTALL_PREFIX, among other things, determines where PEAR will be installed. The tutorial suggest the value of INSTALL_PREFIX be the following path ...
"/home/MY_USER_NAME/pear"
where MY_USER_NAME = my user account
Having come from a Windows world, applications are installed on the system where everyone can use them. If I install PEAR underneath my user directory will other developers on the system be able to make use of PEAR in their PHP scripts? I want to make PEAR available to all users and not just myself.
Could someone explain to me the difference between installing for all users and installing just for myself? Does the install location matter? Should I be installing PEAR in a different location?
Thanks for any suggestions.
P.S. The tutorial I am following is located at the following URL ...
http://articles.sitepoint.com/article/getting-started-with-pear/2
Amend your INSTALL_PREFIX...
typically PEAR gets installed to /usr/share/php/
Have you read through the install section on the PEAR site?
There is no law against giving others access to your home directory but in practice it is never done. If you wanted to do that you would have to set the correct directory permissions and the other users would need to put your stuff on their PATH. But don't, it's bad if only because others can see all your stuff, accidentally (or maliciously) delete things, etc.
You should read a few things on file system standards and file system hierarchy and figure out what is appropriate for you system. Usually it will be something like /opt or /usr/local which will be accessible to all users. Usually you will need to have root permissions to install in global locations.