I've already installed the RabbitMQ on my server and everything is working fine with it. I already tried to send and receive queued messages with a Java client and everything went perfect.
Now I need to install a PHP RabbitMQ client because I want to communicate a Java program with a PHP webpage, but this time I'm not beign so lucky.
I already followed the steps of the official webpage for this installation, specifically these steps:
# Download the rabbitmq-c library
hg clone http://hg.rabbitmq.com/rabbitmq-c/rev/3c549bb09c16 rabbitmq-c
cd rabbitmq-c
# Add the codegen requirement
hg clone http://hg.rabbitmq.com/rabbitmq-codegen/rev/f8b34141e6cb codegen
# Configure, compile and install
autoreconf -i && ./configure && make && sudo make install
And actually on the console I can see that it was "installed" without any problems. But when I try to open any AMQP Connection I get this error:
Fatal error: Class 'AMQPConnection' not found
Actually if I use the phpinfo(); command I can't see anything related to an AMQP module (like in this question). So I think that it may be a problem with the installation but I tried reinstalling it two times and it keeps saying that everything went well.
Have anyone crossed with this problem too?
Solved it..
The module wasn't being loaded in the right php.ini file. Just added extension=amqp.so at the end of the right php.ini file and restarted Apache.
Related
I have a Debian 8 distribution and am trying to get the tcpdf php library running for generating pdf documents. I notice that it is already installed as a package when searching for it in Synaptic Package Manager. It's version 6.0.093+dfsg-1 and its location is /usr/share/doc/php-tcpdf. I looked around online for instructions and tutorials for using the library in my php scripts but haven't found anything explicit and instructive. Neither do the official sites: https://tcpdf.org/ and https://github.com/tecnickcom/tc-lib-pdf offer any setup, installation, or integration documentation.
I downloaded the TCPDF-master.zip from https://github.com/tecnickcom/TCPDF , pasted it into my /var/www/html/ directory, but when I try running one of the examples, or the index.php file, the browser just gives me the following error:
The localhost page isn’t working localhost is currently unable to handle this request. HTTP ERROR 500
The error.log file at /var/log/apache2 displays:
PHP Fatal error: Unknown: Failed opening required '/var/www/html/tcpdf/examples/example_001.php' (include_path='.:/usr/share/php:/usr/share/pear') in Unknown on line 0
I received the same errors even after installing PEAR and also when trying to run the fpdf library.
Please instruct me to follow the proper procedure on correctly using this library. Thanks.
First, install composer as described at http://www.bravo-kernel.com/2014/08/how-to-install-composer-on-debian/ . Make it globally available by running the following commands while logged in the terminal as user:
$ cd /usr/src
$ sudo apt-get install curl php5-cli
$ curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
If the terminal responds with the following errors:
E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)
E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?
a system restart might be needed due to a possibility of apt-get (or some GUI frontend to it) being halted while executing, leaving apt in a locked state.
Verify the installation:
$ composer --version
which should output:
Composer version 1.3.0 2016-12-24 00:47:03
or something similar.
Afterwards, navigate to the desired directory within terminal where you want to locally install the composer dependency. For instance: /var/www/html/ which is the web root on Debian. Input the command for installing the tcpdf php library:
composer require tecnickcom/tcpdf
as stated at https://packagist.org/packages/tecnickcom/tcpdf
All should now operate as intended.
I'm attempting to install Phalcon Dev Tools on OSX. I have Phalcon installed and it works fine.
I've followed the instructions from here: http://docs.phalconphp.com/en/latest/reference/mactools.html
When I run the command phalcon in the terminal I get the following output:
Phalcon Developer Tools Installer
Make sure phalcon.sh is in the same dir as phalcon.php and that you are running this with sudo or as root.
Installing Devtools...
Working dir is: /Users/me/phalcon-tools
Done. Devtools installed!
Now how do I use the devtools? When I enter phalcon commands the output is exactly the same as above, and continues to tell me that it's installed.
Am I missing something here?
I noticed in the phalcon.sh script, at the end it had:
if check_install; then
php "$PTOOLSPATH/phalcon.php" $*
fi
So, if check_install passes, run phalcon.php. I've tried to run this script manually and nothing happens at the terminal.
$PTOOLSPATH is defined. I confirmed this using echo $PTOOLSPATH.
My /usr/bin/env php is correct and points to MAMP's PHP. I have Phalcon installed using MAMP at the moment. My PHP is correct:
which php
/Applications/MAMP/bin/php/php5.5.23/bin/php
Inspecting the phalcon.php script, and using xdebug, I detected the issue to be lying here:
if (!extension_loaded('phalcon')) {
throw new Exception(
sprintf(
"Phalcon extension isn't installed, follow these instructions to install it: %s",
Script::DOC_INSTALL_URL
)
);
}
So the Phalcon extension isn't loaded. Not sure why it's not printing the output of the exception in the terminal. But, PHP's error log is showing:
[21-May-2015 22:37:48 Europe/Berlin] PHP Fatal error: Class 'Phalcon\Script' not found in /Users/me/phalcon-tools/phalcon.php on line 41
Now I'm stumped.
Edit:
Running php -m showed me Phalcon isn't installed. Which is odd, because I am using Phalcon in my web application, and it works fine. As you can see, I've loaded the extension in the php.ini.
The PHP version I'm using is:
PHP 5.5.23 (cli) (built: Apr 9 2015 19:29:27)
As you can see, Phalcon is in the correct directory:
ls /Applications/MAMP/bin/php/php5.5.23/lib/php/extensions/no-debug-non-zts-20121212
apcu.so
imagick.so
phalcon.so
...
And as you can see from phpinfo() it's installed ...
The following commands both give different results too:
Shows Phalcon as installed:
echo "<?php phpinfo(); ?>" | php > phpinfo.txt && cat phpinfo.txt | grep phalcon
Shows Phalcon not installed:
php -m
Any ideas?
After trying a lot, I found out that the code shown in the reference is wrong:
ln -s ~/phalcon-tools/phalcon.sh ~/phalcon-tools/phalcon
chmod +x ~/phalcon-tools/phalcon
The proper way can be found in the github repo:
ln -s ~/phalcon-devtools/phalcon.php /usr/bin/phalcon
chmod ugo+x /usr/bin/phalcon
Basically, the link shouldn't be the script but the php file. Fixing that, I could run the dev tool properly.
I have the same problem with you. and I solved it as long as I add this two line into my ~/.bash_profile file.
export PATH=$PATH:/Users/scott/phalcon-tools
export PTOOLSPATH=/Users/scott/phalcon-tools
At first, I only add the first line into .bash_profile, and I got the same information with you.
May be in command line ini file phalcon is not installed so it is throwing error.
just type this command in terminal .
php --ini
then check the output the interesting line is
Loaded Configuration File: /etc/php5/cli/php.ini
now try to check that
phalcon.so
is loaded there as well or not.
as for web and cli there are different phalcon.so file is provided so we need to inlcude "phalcon.so" in both files.
so phalcon.so is included in your web php.ini so its running smooth there and not it command line i guess.
I installed node.js from sources (./configure && make && make install) under /usr/local/bin/node. Afterwards I installed the less compiler globally with npm -g install less under /usr/local/lib/node_modules/less/. So node and less are located under their default paths.
I am using kriswallsmith/assetic to compile my less files through PHP, therefore I adjusted path to /usr/local/bin/node. Everytime I run my script I get the error Error: Cannot find module 'less', I had the same behavior through command line. But I found a solution (ln -s /usr/local/lib/node_modules/ ~/.node_libraries) to fix the problem and after this it worked out on command line. Through PHP the problem still persists - PHP is running through FastCGI with the same user I used on command line.
How can I fix this problem through FastCGI/PHP too?
Constructor of assetic's LessFilter accepts an array of nodePaths. Adding /usr/local/lib/node_modules/ as a nodePath solves the problem.
I am installing wordpress using Google App Engine and using this command to run the application, app_dir contains app.yaml, php.ini and wordpress:
google_appengine/dev_appserver.py app_dir/
and getting these errors:
File "/home/g1m/google_appengine/google/appengine/tools/devappserver2/php_runtime.py", line 222, in new_instance
self._check_environment(php_executable_path)
File "/home/g1m/google_appengine/google/appengine/tools/devappserver2/php_runtime.py", line 147, in _check_environment
'flag (%s) does not exist.' % php_executable_path)
_PHPBinaryError: The path specified with the --php_executable_path flag () does not exist.
I am trying to access the application using this url: localhost:8080 and get following error:
The path specified with the --php_executable_path flag () does not exist.
Kindly help me to solve this, what is the value of php_executable_path in LAMP as I am using UBUNTU12.04 operating system, is it /etc/php/cgi ?
Kindly let me know where I am doing wrong.
Make sure you install it first by doing:
sudo apt-get install php5-cgi
then locate it by running a search for php-cgi
sudo find / -name php-cgi
in my case i found it in : /usr/bin/php-cgi
I think the reason for this error is that GAE need to work with cgi not cli. The difference in them is that cli (command line interface) is for standalone application, not for web app (it didn't output html header by default). If php-cgi is installed , you can specify its path like this when you start dev server
<PATH_TO_SDK>app_devserver.py --php_executable_path=/usr/bin/php-cgi <your_project_name>
If you are not sure, you could search for it like dsb005 suggested.
If it's not installed... hmm... Maybe you miss this one on GAE document :
HP 5.4 is not packaged on most Linux distributions so it may be easiest to install it from source. On Debian-based Linux systems, you can use the following commands to install PHP 5.4 in such a way that it won't effect any other versions of PHP that you may have installed:
I suggest you follow the instruction on
https://developers.google.com/appengine/docs/php/gettingstarted/installinglinux and see if it works. It's always a pay off when you don't read the manual. I did that sometimes :(
I am trying to install phpredis to work with my php.
But the thing is, every time I try to get it to work, my error_log sends this error:
[code]PHP Fatal error: Class 'Redis' not found in /var/www/html/testme.php on line 5[/code]
I have downloaded the source code from http://github.com/owlient/phpredis
and then
phpize
./configure
make && make install
but still not working.
What can I do now?
specifically, created a redis.ini:
$ cat /etc/php5/apache2/conf.d/redis.ini
;configure the redis module
extension=redis.so
I filed a github issue, hopefully they'll make it create the ini automatically, or at least explain in the install instructions:
https://github.com/owlient/phpredis/issues/94
I got it to work.
I had to give the full path in php.ini, restarted httpd and voila it works :D