Phalcon devtools not working - php

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.

Related

zsh: command not found: php. PHP is installed and working with MAMP

I am trying to use composer to install a google client library, but cannot install composer or use php on the command line.
I am using php 8.0.8 with MAMP and it is working fine, so I know it is installed.
If I type php in the terminal, I receive the command not found message. Thinking it could be an environment variable, I have tried navigating to the php folder /Applications/MAMP/bin/php/php8.0.8/lib/php and tried the php command again, but still get the same error
I am using a Mac running Monterey
Change default Mac OS X PHP to MAMP's PHP Installation and Install Composer Package Management
Instructions to Change PHP Installation
First, Lets find out what version of PHP we're running (To find out if it's the default version).
To do that, Within the terminal, Fire this command:
which php
This should output the path to the default PHP install which comes preinstalled by Mac OS X, by default it has to be (Assuming you've not changed it before):
/usr/bin/php
Now, We just need to swap this over to the PHP that is installed with MAMP, which is located at /Applications/MAMP/bin/php/php5.4.10/bin (MAMP 2.1.3)
To do this, We need to edit the .bash_profile and add the MAMP version of PHP to the PATH variable.
Follow these simple steps:
Within the Terminal, run vim ~/.bash_profile
Type i and then paste the following at the top of the file:
export PATH=/Applications/MAMP/bin/php/php5.4.10/bin:$PATH
Hit ESC, Type :wq, and hit Enter
In Terminal, run source ~/.bash_profile
In Terminal, type in which php again and look for the updated string. If everything was successful, It should output the new path to MAMP PHP install.
In case it doesn't output the correct path, try closing the terminal window (exit fully) and open again, it should apply the changes (Restart in short).
Install Composer Package Management
Now you can fire the command to install the composer globally (So you can access it from anywhere):
$ curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
You can verify your installation worked by typing the following command within the Terminal:
composer
It'll show you the current version and a list of commands you can use if the installation was successful.
Original source

MAMP and PHP on Terminal

So I have installed MAMP and I am using PHP, however I also used Terminal with PHP as well. Now for some reason Terminal is not working with PHP anymore, for example:
Terminal / PHP command not found
So basically I can not work with anything at the moment. I have also simplified .bashrc and .bash_profile.
Terminal and PHP not found
Thanks. mac-machine
cd ~ && nano .zshrc
Add the path of php in .zshrc like:
export PATH=/Applications/MAMP/bin/php/php8.0.8/bin:$PATH
Then run source .zshrc and run php -v to confirm path setup
The problem is working with PHP command line is not found with ZSH, it gets a message: zsh: command not found: php.
So working with older BASH instead of ZSH it works fine.

PhpStorm + XAMPP not showing latest PHP version in command line

I am using OSX running on El Capitan and setting up PhpStorm and the Laravel environment has been a nightmare. I created a project setting up Composer and created it with laravel/laravel from the options menu.
As you can see in the screen shot, the PHP version says 5.6.31.. but if I type php -v in the command line. It gives me php 5.5 (as shown in the bottom left)
If I type php -v in the terminal I also get php 5.6.
which php returns me /usr/local/bin/php
I originally had a problem where PHP would not upgrade to 5.6.. but I managed to solve this with homebrew.
And if I use terminal and cd into the folder to run artisan key:generate and config:clear .. I am able to get the Laravel homepage to load (but typing this from the PhpStorm command line does not work).
My understanding is that the command line is pointing to the directory of PHP that came with my Mac? So how do I point it to the upgraded version? Or is the problem something else?
I think this is a strange problem and already a few people I have asked have not been able to solve it (also setting this up is all very new to me).
what I did is to set an alias on my ~/.bashrc to point php command to point to /Applications/XAMPP/bin/php
e.g. alias php="/Applications/XAMPP/bin/php"
in your case, you can use your XAMPP's full path to your php binary file as you might have different installation paths.
You should be able to add:
export PATH=/Applications/XAMPP/xamppfiles/bin/php5.6.31:$PATH
to your ~/.bash_profile (assuming you're running a bash shell). Then just run source ~/.bash_profile and it should all work.

Why PHPStorm says "dyld: Library not loaded: /usr/local/lib/libpng15.15.dylib" when I run tests?

Each time I try to run tests with PHPStorm I get this error:
/usr/bin/php /private/var/folders/jl/34t9y2h94jsgchv4wfcxl6g80000gn/T/ide-phpunit.php -c app --configuration /Users/simonegentili/Sviluppo/web/wishventures/SendA/app/phpunit.xml.dist WishVentures\GeeftyApiBundle\Test\Controller\ApiControllerTest /Users/simonegentili/Sviluppo/web/wishventures/SendA/src/WishVentures/GeeftyApiBundle/Tests/Controller/ApiControllerTest.php
Testing started at 18:46 ...
dyld: Library not loaded: /usr/local/lib/libpng15.15.dylib
Referenced from: /usr/bin/php
Reason: image not found
Process finished with exit code 133
I've found this question but
$ brew update && brew upgrade
$ brew reinstall php55
did not solve my troubles. Well, ... PHPStorm is looking for libpng15.15.dylib, but I've libpng16.16.dylib. I think is a broken link issue. How to solve it?
The reason was that I had two version of php installed on my computer. One reached via /usr/bin/php and another from /usr/local/bin/php. The first one was a link to php version 5.5.8 and the second one was 5.5.14
I sow that dyld (dynamic linker of Operating System) was looking for /usr/local/lib/libpng15.15.dylib (maybe called by php 5.5.8) but inside my /usr/local/lib/ there was not. In that folder, I got libpng16.16.dylib (I think ... because I've installed php55 via brew and this version oh php needs new version of libpng).
I undestood that my /usr/bin/php was a pointer to php 5.5.8. Instead, ... /usr/local/bin/php was 5.5.14. PHPStorm worked with /usr/bin/php that is default configuration. When I run php via console, I run /urs/local/bin/php.

What is php_executable_path in LAMP ubuntu12.04?

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 :(

Categories