I've just installed PEAR into WAMP attempting to follow this article. It all seems to have gone okay but when I type "pear upgrade" into the command prompt I get this error:
ERROR: failed to mkdir c:\php\pear\docs\Archive_Tar\docs
It is looking on the wrong drive (and missing a subdirectory in that path by the looks of it). It should be looking for D:\php\php5.3.13\pear\docs\Archive_Tar\docs
When specifying installation directories I chose ones on the D:\ and thats where the folder structure is, the include_path in both php.ini locations have also been updated. I've also reset the WAMP server after making the changes.
How do I set it to look / install the package in the right place?
My advice is to remove your complete PEAR installation and install from scratch. It'll save you time and sweat. If you have the time and patience, you can fix PEAR parameters with the config-* subcommands:
C:\>pear
Commands:
[...]
config-create Create a Default configuration file
config-get Show One Setting
config-help Show Information About Setting
config-set Change Setting
config-show Show All Settings
Start with pear config-show to inspect current values and see if you can spot invalid ones.
Related
I am new in TYPO3, I have a running system online and wanted to copy to my localhost, I copied the folder in /var/www/my_production/
I created the database, I can access to the backend without problem but I cant open my site, I get this error :
1323059807: You are not allowed to create directories in the folder "/" (More information)
TYPO3\CMS\Core\Resource\Exception\InsufficientFolderWritePermissionsException
thrown in file
/var/www/my_production/typo3/sysext/core/Classes/Resource/ResourceStorage.php
in line 2021.
Any idea how I can fix that problem?
EDIT ::
After clearing the cache from the Install Tool, I got :
Fatal error: Call to undefined function
TYPO3\CMS\Core\Utility\xml_parser_create() in
/var/www/clevvermail_dev/typo3/sysext/core/Classes/Utility/GeneralUtility.php
on line 2252
One possible cause is that XML is missing.
Try: sudo apt-get install php7.0-xml or sudo apt-get install php5.6-xml
First steps for each new TYPO3 installation: enter Install Tool and reduce all errors possible. (You might stay with some errors, but you need to understand them.)
TYPO3 gives a lot of hints what has to be changed.
typical errors:
missing directories
missing rights in directories
wrong configuration in php.ini
missing php modules
database errors (connection, user, password)
try to solve these errors first.
Since TYPO7 you can check your extensions from the Install Tool.
For earlier versions:
disable all additional extensions (in PackagesState.php) and get the core working, then enable one extension after the other.
I'm using Bluehost and do have access to SSH, thankfully. I've also set my PHP to 5.4 in the Control Panel settings. Now, here's the two big questions that I can't seem to grasp: how do I install Composer and furthermore, after installing Composer, how do I get the dependencies included?
In this case, I am attempting to use the official Tumblr PHP Library, which has dependencies -- all of which can be found on Packagist.
I've referred to this question in which the OP is using HostGator. I have attempted to install Composer in a similar fashion and have done so with seemingly successful results. The issue, however, is that I don't know where to install it on Bluehost so I now have Composer installed in several random places on the server simply because I don't know how to navigate to find where to put it in this shared space.
I know this is the issue (i.e. it's installed in the wrong place) because when I use the composer phar files and syntax to install the packages, I get errors saying the commands don't exist.
I really hate asking for hand-holding assistance, but if someone could walk me through the proper installation of Composer on a shared space and the proper installation of a Composer package from Packagist on the same shared space, it would be much appreciated. I've dug through the Composer documentation and can't seem to find a proper guide -- if one can even exist -- for this case. At this point, I'm wondering if it's going to be different for every web host.
Once you install composer as mentioned by KLVTZ. In the bluehost environment, use the php-cli instead of php.
php-cli composer.phar install
When installing composer, the biggest problem I ran into was that Bluehost's command line php was 5.2 and composer needs 5.3+.
Fortunately, Bluehost does give you access to 5.4. You can find it at
/ramdisk/php/54/bin/php54-cli
I ended up setting up an alias to call composer.phar using the above php command and it's worked great. You can see more details on how to install composer on bluehost.
You should probably not use Composer on the remote host, but instead install it on the local machine that is used to upload your project to Bluehost. There you can manage all the stuff that is needed to fetch the dependencies, which might include having the ZIP extension enabled or having a ZIP program available, having GIT or Mercurial installed if you have to grab a version from a branch, and so on.
All these dependencies of using Composer might not be available on that remote host, and frankly: You really do not want to install these development tools on a production machine anyway, I think. Any software that potentially helps an attacker shouldn't be present if it can be avoided.
The issue, however, is that I don't know where to install it on Bluehost...
In order to fix this problem, you need to figure out where exactly your project folder is. Composer needs to be installed in that folder. If you have access to a UNIX shell, I recommend that you change your directory to that project folder
cd $_SERVER['DOCUMENT_ROOT']/project_folder/
Generally, your remote server will follow the same file directory tree as that on your local machine. However, if you are unsure as to how your file structure may be organized, you can always print working directory of your local machine:
pwd
After you have successfully located the correct file path on your shared space, simply install composer:
curl -sS https://getcomposer.org/installer | php
This will report back something like:
All settings correct for using Composer
Downloading...
Composer successfully installed to: /var/www/my_project/composer.phar
Use it: php composer.phar
You now have access to your composer.phar in your project. Let me know if you need any further help.
One problem on Bluehost is that the php command on Bluehost does not execute php-cli. So I "bypass" that by having my own php script earlier in the PATH and then forwarding the arguments to php-cli. In the same process I made script named composer which calls php-cli composer.phar directly.
So, this setup has worked for me on Bluehost:
In ~/bin I have the composer.phar and two bash scripts called php and composer. In ~/.bash_profile I have prepended ~/bin to my PATH.
~/bin/php looks as follows:
#!/bin/bash
php-cli "$#"
~/bin/composerlooks as follows:
#!/bin/bash
php-cli ~/bin/composer.phar "$#"
And the additions to ~/.bash_profile are these:
PATH=$HOME/bin:$PATH
PATH=$PATH:$HOME/.composer/vendor/bin
export PATH
(I have also added ~/.composer/vendor/bin as can be seen, this is handy for global access for some composed applications (for me that is laravel)).
Remember to source ~/.bash_profile. (Or reconnect)
I think you should do something like this.
In console
echo $PATH
Use one of these pathes
mv composer.phar {selected path}/composer
chmod +x {selected path}/composer
Now you can simply call composer everywhere
If you have composer installed in your root directory (under public_html), might be something related to PHP version. As Bluehost when chosing PHP version "Be aware that this only modifies your ~/public_html/php.ini file. If you choose to use PHP 5.4, you'll want to make sure your crons use "/usr/php/54/usr/bin/php" instead, as otherwise it will use PHP 5.2."
So you can try with the command
/usr/php/54/usr/bin/php-cli composer.phar install
Can you walk me through the installation of a library for php, specifically what each terminal command does?
I have been learning web development for 6 months and it is time I need the console / terminal. I can't find any beginner walkthrough of using the terminal to add libraries and plugins to PHP. There are a lot of tutorials for specific steps or errors, but none start to finish.
If you want specifics to make your example concrete, here is what I am trying to install:
The library I am installing: http://code.google.com/p/phpquery/.
My directory for PHP on MAMP: /Applications/MAMP/bin/php/php5.3.6/bin
Thanks!
Don
edit:
I figured out my specific issue, but I don't think I really understand what I did, so I can't repeat it by myself in any other situation. This thread can help a lot of new terminal users including myself. The type of response I am looking for would go like this:
Step 1: Open your terminal. (This is an alternative way to navigate and execute commands on files on your computer).
Step 2: Find out where MAMP is installed however you like. Then go to your terminal, and type in cd followed by the path. cd stands for current directory and tells your terminal where it should execute its commands. The command you use will be very similar to this cd /Applications/MAMP. This will make your current directory MAMP.
Step 3: You are adding a library to PHP. So you need to go to the PHP folder in MAMP.... (please help us from this part!)
I just checked and it is available in pear channels.
# this is from their site
pear channel-discover phpquery-pear.appspot.com
pear install phpquery/phpQuery
Of course, for Mac using MAMP, you would use commands like this:
/Applications/MAMP/bin/php5/bin/pear install [package]
So for PHPQuery, try this:
/Applications/MAMP/bin/php5/bin/pear channel-discover phpquery-pear.appspot.com
/Applications/MAMP/bin/php5/bin/pear install phpquery/phpQuery
Same method should apply to pecl extensions as well.
EDIT
I personally just installed it on mine to test, here were my results:
$ /Applications/MAMP/bin/php5/bin/pear channel-discover phpquery-pear.appspot.com
Adding Channel "phpquery-pear.appspot.com" succeeded
Discovery of channel "phpquery-pear.appspot.com" succeeded
$ /Applications/MAMP/bin/php5/bin/pear install phpquery/phpQuery
downloading phpQuery-0.9.5.386-pear.tgz ...
Starting to download phpQuery-0.9.5.386-pear.tgz (100,990 bytes)
......................done: 100,990 bytes
install ok: channel://phpquery-pear.appspot.com/phpQuery-0.9.5.386
This should work with any PEAR or PECL extension. Check out this page for a list of PEAR packages.
EDIT 2
Make sure /Applications/MAMP/bin/php5/lib/php is in your include path! That is where phpQuery.php will be located once you've downloaded the PEAR packages properly with MAMP.
EDIT 3
Per cshu's comment, he mentioned that these packages are no longer maintained and that you should use this instead:
$ /Applications/MAMP/bin/php5/bin/pear channel-discover pear.querypath.org
$ /Applications/MAMP/bin/php5/bin/pear install querypath/QueryPath
Resolved!
I uninstalled phpunit from pear and then reinstalled it again. I believe I was using the wrong/old/not enough sources before installing. Works like a charm!
So I'm trying to set up PEAR & PHPUnit. I was following http://www.newmediacampaigns.com/page/install-pear-phpunit-xdebug-on-macosx-snow-leopard but after I installed pear I had a different directory structure in /usr/local. Regardless, I was able run the phpunit install. But now I'm lost and asking for help before I make a bigger mess :)
pear config-show says:
PEAR directory php_dir /usr/local/share/pear
And my php.ini file (and confirmed in phpinfo() says:
include_path=".:/usr/local/share/pear"
So that's good, right? But now what? I get
Failed opening required 'PHPUnit/Framework.php' (include_path='.:/usr/local/share/pear')
If I try to include it in the php. And I have no idea where the binary might be to run it from the command line.
Inside /usr/local/share/pear/PHPUnit there are two directories "Extensions" and "Framework"
It sometimes happen that the install fails on PHPUnit specifically, but succeeds on the dependencies, so it only looks like the install was succesfull.
Try this when installing
pear install --force --alldeps phpunit/PHPUnit
The --force option will force the install of PHPUnit, even if all the dependencies can't be met. In my case there was a missing dependency for the dom PHP extension which blocked the installation even though the PHP_Invoker package could be used instead.
The --alldeps option makes sure that all of the dependencies got installed.
Check for a bin directory in the pear install, something along the lines of /usr/local/share/pear/bin/ - your install is different than mine..
You could also try searching for the binary -
find /usr/local/share/pear -name 'phpunit'
I'm working on a project that'll use PEAR packages. Because you never know what version of the PEAR package will be installed on your hosting provider (and especially because I require a patch to have been applied to one of the packages), I'd like to put the PEAR source for my project right into SVN, so other developers can immediately have the dependencies.
But everything related to PEAR seems to have absolute directories! Running "pear config-create . pear.conf" to set up a new PEAR directory even fails with the error message:
Root directory must be an absolute path
I checked out the pear config files on some other servers and they, too, seem to have absolute paths.
Whenever a developer checks this out to his own machine, or we export it all to a server, we don't know what the absolute path will be.
Is there any way to set this up?
I couldn't get my Hosting provider to install the PEAR libraries I wanted. Here's how I made PEAR part of my source tree.
1. Create a remote.conf file
Creating your remote.conf is a little different than in the manual. Lets say I want to install PEAR in vendor/PEAR of a project. You would do it like this:
#from the root of the project
$ cd vendor ; mkdir PEAR ; cd PEAR
$ pear config-create <absolute path to project>/vendor/PEAR/ remote.conf
2.Update the channels
$ pear -c remote.conf channel-update pear.php.net
3. install PEAR
$ pear -c remote.conf install --alldeps pear
4. install any other libraries
$ pear -c remote.conf install --alldeps <libname>
Voila... PEAR is part of the source tree.
The Catches:
Even though the paths in remote.conf are absolute the libraries themselves will still work. It's just updating that won't work from anywhere. You will need to update it from the same path that it was created from -- in the above case, from vendor/PEAR.
Some libraries don't like being outside the path, so you may have to add vendor/PEAR to the path (I've got code, just ask if you need.)
If you have PHP 5.3.1 use Pyrus, the PEAR2 installer. The pyrus managed installations can be moved where ever you like.
Download pyrus -
$> wget http://pear2.php.net/pyrus.phar
Create a directory to store your pyrus-installed packages:
$> mkdir mylibs
Install packages -
$> php pyrus.phar mylibs install pear/Net_URL
Your installed package is now at mylibs/php/Net/URL.php
Note that we passed the mylibs directory to indicate what directory to install to, as well as the channel name 'pear' (the default in pyrus is pear2.php.net). For convenience, the pyrus.phar file can be executed from cli if you chmod +x it.
You can move the mylibs directory wherever you'd like. Even commit it to your repository.
Lots of docs on the PEAR website.
I'm note entirely sure if this answers your question, but you can specify the location for the PEAR repository on the commandline, so you can create a local repository, using:
pear install --force --installroot=/path/to/my/pear/ PEAR
Then you can install additional packages using:
pear install --installroot=/path/to/my/pear/ SomePackage
To use the local repo from within your app, you have to make sure that the include_path points to the local repo, rather than the default (globally installed) repository. So you'd want it to look like this:
include_path = ".:/path/to/my/pear/usr/share/php"
Re :
Actually, he wants to avoid the absolute paths so that the solution can be checked out from many machines without depending on the path each one has the repository installed.
-- Carlos Lima
Seems you're right. In that case, I would advice that you don't check the PEAR repository into your SVN repository, but rather use a deploy script to install/update the repository at the server. Just make sure to install a particular version. (You do have an automated deploy, right?)