phpunit and yii - (PHPUnit/Autoload.php): failed to open stream: - php

Having a lot of problems installing phpunit with Yii. I run:
$ phpunit unit/dbTest.php
But it turns out this error:
PHP Warning: require_once(PHPUnit/Autoload.php): failed to open stream: No such file or directory in /opt/yii-1.1.10.r3566/framework/test/CTestCase.php on line 12
(include_path='.:/usr/bin:/usr/share/php:/usr/bin/pear:/usr/share/php/Zend/:/opt/php5.3.10/lib/php/PHPUnit'
Some details about my installation:
$ phpunit --version
PHPUnit 3.4.5 by Sebastian Bergmann.
php --version
PHP 5.3.10 (cli) (built: Apr 6 2012 20:06:37) ( rebuilt didn't help :( )
pear list phpunit/phpunit
....
php /opt/php5.3.10/lib/php/PHPUnit/Autoload.php
According to that info, autoload is installed, and is on the include path.
I'm unsure what else I need to do - can anyone shed a light please?

I hope this is of some use to someone:
It seems on ubuntu PEAR is broken for this task and apt-get won't help either.
This is how i solved it
Manually download from http://pear.phpunit.de/
phpunit/PHPUnit
and
phpunit/File_Iterator
PHPUnit_MockObject
phpunit/PHPUnit_Selenium
PHP_CodeCoverage
Manually dezip and put correctly in php lib or wherever you want them to go. Put the head of this library on your include path (PHP, PHPlib, PEAR are all at this root level on my setup.)
Goddam, hope that helps someone i spent about 6 hours getting this to work last nite...

As rix shows in his answer, you have to download some files manually.
I got it working on Ubuntu 10.04 following these commands:
wget http://pear.phpunit.de/get/PHPUnit-3.6.10.tgz
wget http://pear.phpunit.de/get/File_Iterator-1.3.1.tgz
wget http://pear.phpunit.de/get/PHPUnit_MockObject-1.1.1.tgz
wget http://pear.phpunit.de/get/PHPUnit_Selenium-1.2.6.tgz
wget http://pear.phpunit.de/get/PHP_CodeCoverage-1.1.2.tgz
wget http://pear.phpunit.de/get/PHP_TokenStream-1.1.3.tgz
wget http://pear.phpunit.de/get/Text_Template-1.1.1.tgz
wget http://pear.phpunit.de/get/PHP_Timer-1.0.2.tgz
sudo vi /etc/php5/cli/php.ini
=> add /usr/share/php/PHPUnit/ to include_path directive
tar xzf PHPUnit-3.6.10.tgz
cd PHPUnit-3.6.10/
sudo cp -r PHPUnit/ /usr/share/php/
sudo ln -s /usr/share/php/PHPUnit /usr/bin/PHPUnit
tar xzf File_Iterator-1.3.1.tgz
sudo cp -r File/ /usr/share/php/PHPUnit/
tar xzf PHP_CodeCoverage-1.1.2.tgz
cd PHP_CodeCoverage-1.1.2/
sudo cp -R PHP/ /usr/share/php/PHPUnit/
tar xzf PHP_TokenStream-1.1.3.tgz
cd PHP_TokenStream-1.1.3/PHP/
sudo cp -r Token* /usr/share/php/PHPUnit/PHP/
tar xzf Text_Template-1.1.1.tgz
cd Text_Template-1.1.1/
sudo cp -r Text/ /usr/share/php/PHPUnit/
tar xzf PHP_Timer-1.0.2.tgz
cd PHP_Timer-1.0.2/
sudo cp -r PHP/Timer* /usr/share/php/PHPUnit/PHP/
tar xzf PHPUnit_MockObject-1.1.1.tgz
cd PHPUnit_MockObject-1.1.1/
sudo cp -r PHPUnit/Framework/MockObject/ /usr/share/php/PHPUnit/Framework/
tar xzf PHPUnit_Selenium-1.2.6.tgz
cd PHPUnit_Selenium-1.2.6/
sudo cp -r PHPUnit/Extensions/* /usr/share/php/PHPUnit/Extensions/

Related

000-default.conf not found while building docker image of Laravel app on windows

I am trying to deploy my Laravel application on AWS using docker image by following given tutorial:
https://medium.com/#okekedesmond/deploying-containerized-laravel-application-using-aws-ec2-instances-with-docker-and-rds-883e8f6d6245
I am stuck at first point while building docker image. Here is my Dockerfile:
# Defining the base image for our project, if you understand how docker images and layers work, this should not be difficult to understand.
FROM php:7.3-cli
# We need to update the image and install some import packages
RUN apt-get update -y && apt-get install -y openssl zip unzip git curl libpng-dev libonig-dev libxml2-dev
# cleaning packages and install scripts
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
# Installing composer which is used to install Laravel
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin –filename=composer
#Creating a configuration file for apache and linking
ADD 000-default.conf /etc/apache2/sites-available/
RUN ln -sf /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-enabled/000-default.conf
#Restarting Apache
RUN a2enmod rewrite
RUN service apache2 restart
# Create a work directory and copy all project file into the
WORKDIR /var/www/app/
COPY . /var/www/app
#Granting permissions to files and folders
RUN chmod -R o+w /var/www/app/storage
RUN chown -R www-data:www-data ./storage
RUN chgrp -R www-data storage bootstrap/cache
RUN chmod -R ug+rwx storage bootstrap/cache
RUN chmod -R 755 /var/www/app/
RUN find /var/www/app/ -type d -exec chmod 775 {} \;
RUN chown -R www-data:www-data /var/www
# Installing dependencies from laravel package
RUN composer install --no-scripts --no-autoloader --no-ansi --no-interaction --working-dir=/var/www/app
#Running some packages
RUN docker-php-ext-install mbstring pdo pdo_mysql mbstring exif pcntl bcmath gd opcache
#Running Laravel on docker, because we are using the php-7.3-cli so we have to use a php server in our docker image
CMD php artisan serve --host=0.0.0.0 --port=80
EXPOSE 80`
It is giving error at step no. 5:
Step 5/21 : ADD 000-default.conf /etc/apache2/sites-available/
ADD failed: file not found in build context or excluded by .dockerignore: stat 000-default.conf: file does not exist
How do I solve it on windows? any help will be appreciated
I think the best solution is to manually make a new one, here is an example file:
https://gist.github.com/tjtoml/942d696c868b22a25259
And it should be located in:
/etc/apache2/sites-available/000-default.conf
It could be that you have to customize it for your needs

Can't install composer on OS X

I did this on terminal:
$ curl -sS https://getcomposer.org/installer | php
the output was:
All settings correct for using Composer
Downloading...
Composer successfully installed to: /Applications/XAMPP/xamppfiles/htdocs/composer.phar
Use it: php composer.phar
then I entered:
$ sudo mv composer.phar /usr/local/bin
No issues with this (it should work because usr/local/bin is in my $PATH). But how do I run it now? When I enter composer or composer.phar on the command line, I get:
-bash: composer: command not found
-bash: composer.phar: command not found
.phar is short for PHP Archive - it's a format that the php executable can read, not an executable on it's own right. To run it you should use:
$ php /usr/local/bin/composer.phar
To make your life a tad easier you could, of course, define an alias:
$ alias composer="php /usr/local/bin/composer.phar"
And then just call composer from your shell.
Did u check what do u have now in your path
ls -al /usr/local/bin
Check the right to execute.
To be sure u can do:
sudo chmod a+x /usr/local/bin/composer.phar
First look like should be composer.phar as you did not precise a new name in ur mv command like:
sudo mv composer.phar /usr/local/bin/composer
Did you made composer.phar executable ?
if not, just do sudo chmod a+x /usr/local/bin/composer.phar
$ curl -sS https://getcomposer.org/installer | php
$ sudo mv composer.phar /usr/local/bin/composer
mv: rename composer.phar to /usr/local/bin/composer.phar: No such file or directory
Solution:
make sure composer.phar and directory local ,bin composer exist (/usr/local/bin/composer) in $PATH
else
$ cd usr
usr$m kdir local
usr/local$m kdir bin
usr/local/bin$ mkdir composer
now we're sur local/bin/composer exist than
$sudo mv /path to composer.phar /usr/local/bin/composer
Password:
toto:~ macbookpro$ your composer.phar now is move to directory usr/local/bin/composer

PhantomJS and CasperJS what files do i need to put on my cpanel

Okay so i have finally build a test.js file that works on my ubuntu machine.
I just want to know how to i add phantomjs and casperjs on my cpanel and is there any way i can tet that they both work once on cpanel?
You can SSH / Shell Access from your cPanel account if you have permissions. Contact your host provider to be certain.
Here are the following commands that you can copy and paste into SSH to install dependencies, PhantomJS, and CasperJs. Dependents tested using docker.io:
apt-get install -y libfreetype6 libfontconfig libreadline-dev wget tar bzip2 vim git
mkdir -p /srv/var
cd /srv/var
PhantomJS:
wget http://phantomjs.googlecode.com/files/phantomjs-1.9.2-linux-x86_64.tar.bz2
tar -xjf phantomjs-1.9.2-linux-x86_64.tar.bz2
ln -s `pwd`/phantomjs-1.9.2-linux-x86_64/bin/phantomjs /usr/bin/
phantomjs -v
CasperJS:
git clone https://github.com/n1k0/casperjs.git
ln -s `pwd`/casperjs/bin/casperjs /usr/bin/
casperjs --version
If they worked, You can type phantomjs -v or caspjer --version to verify installation.

How to know where did php extension install to in linux

I installed with this command
cd ~
mkdir setups
cd setups
wget http://pecl.php.net/get/APC-3.1.8.tgz
tar -xvf APC-3.1.8.tgz
cd APC-3.1.8
phpize
./configure
make
then where did apc.so install to ?
Edit: Right answer is morre's
could always try "ls -R | grep apc.so" on the root.

Having huge problems getting memcached plugin working on ub 9.04

Heya, so I've spent about 6 hours now trying to get this working. I had the following set of rules I uses to compile in the memcached plugin to php, installing libmemcached dependency first. Here are the steps:
cd ~
sudo wget http://download.tangent.org/libmemcached-0.35.tar.gz
sudo tar -zxf libmemcached-0.35.tar.gz
cd libmemcached-0.35
sudo ./configure
sudo make
sudo make install
cd /usr/lib
sudo ln -s /usr/local/lib/libmemcached.so
sudo pecl install memcached
sudo rm -r ~/libmemcached-0.35
sudo rm ~/libmemcached-0.35.tar.gz
php.ini-edit
Search for Dynamic Extensions and add in the extension memcached.so. Do this by adding: extension=”memcached.so”
:wq
It used to work; last time I rebuilt my box was back in Feb or March, but I've heard that since then there are some changes that go on. When I run sudo make above I get some erroring out. I'm not sure if I included the error anyone could help me debug, so does anyone have a set of instructions they used to get memcached working properly on their ub box? With the libmemcached dependency?
I've seen this: Can I install the memcached PHP extension with PECL?
The author of memcached basically told the guy how to do, but I've tried that to no avail. Help with be really appreciated. Thanks.
cd ~
sudo apt-get -y install g++
wget http://launchpad.net/libmemcached/1.0/0.39/+download/libmemcached-0.39.tar.gz
tar zxvf libmemcached-0.39.tar.gz
cd libmemcached-0.39/
./configure
make
sudo make install
cd /usr/lib
sudo ln -s /usr/local/lib/libmemcached.so
sudo pecl install memcached
sudo rm -r ~/libmemcached-0.39
sudo rm ~/libmemcached-0.39.tar.gz
php.ini-edit
Search for Dynamic Extensions and add in the extension memcached.so
:wq

Categories