LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-29-2009, 10:11 AM   #1
zhjim
Senior Member
 
Registered: Oct 2004
Distribution: Debian Squeeze x86_64
Posts: 1,748
Blog Entries: 11

Rep: Reputation: 233Reputation: 233Reputation: 233
What does [if test "/usr/local/bin/php" = '@'php_bin'@'; then] test for


Hi folks

I'm waiding through some php stuff and came upon the pear script. Within I found the mysteries line
Code:
if test "/usr/local/bin/php" = '@'php_bin'@'; then
and now wonder what the heck '@'php_bin'@' means.

For completion heres the complete pear script
Code:
#!/bin/sh

# first find which PHP binary to use
if test "x$PHP_PEAR_PHP_BIN" != "x"; then
  PHP="$PHP_PEAR_PHP_BIN"
else
  if test "/usr/local/bin/php" = '@'php_bin'@'; then
    PHP=php
  else
    PHP="/usr/local/bin/php"
  fi
fi

# then look for the right pear include dir
if test "x$PHP_PEAR_INSTALL_DIR" != "x"; then
  INCDIR=$PHP_PEAR_INSTALL_DIR
  INCARG="-d include_path=$PHP_PEAR_INSTALL_DIR"
else
  if test "/usr/local/lib/php" = '@'php_dir'@'; then
    INCDIR=`dirname $0`
    INCARG=""
  else
    INCDIR="/usr/local/lib/php"
    INCARG="-d include_path=/usr/local/lib/php"
  fi
fi

exec $PHP -C -q $INCARG -d output_buffering=1 -d variables_order=EGPCS -d open_basedir="" -d safe_mode=0 -d register_argc_argv="On" -d auto_prepend_file="" -d auto_append_file="" $INCDIR/pearcmd.php "$@"
 
Old 10-31-2009, 12:04 AM   #2
ta0kira
Senior Member
 
Registered: Sep 2004
Distribution: FreeBSD 9.1, Kubuntu 12.10
Posts: 3,078

Rep: Reputation: Disabled
Probably a substitution, although I don't use PHP or pear. What happens if you remove @? What happens if you echo '@'php_bin'@'?
Kevin Barry
 
Old 10-31-2009, 01:52 AM   #3
DougRoyal
LQ Newbie
 
Registered: Oct 2009
Location: Midwest USA
Distribution: All of them
Posts: 2

Rep: Reputation: 0
This isn't exactly a pear script; it's a shell script pear uses to get data about how you have PHP set up on your system.

The @ symbol has no relevance to PHP in this context (in a PHP script, the @ symbol suppresses errors, but this isn't a PHP script).

I don't use pear, but, based on what the rest of the script does, it looks like php_bin and php_dir _might_ be either commandline utilities or some kind of environmental variable installed with pear. If pear is set up on your system then php_bin would probably point to your system's PHP installation.

------
update
------
I just stopped by the #pear channel and they called them 'replacements' and told me to type:

pear config-show

which gives a listing of pear's configuration variables.

Last edited by DougRoyal; 10-31-2009 at 11:54 AM. Reason: update with new info
 
Old 11-02-2009, 02:33 AM   #4
zhjim
Senior Member
 
Registered: Oct 2004
Distribution: Debian Squeeze x86_64
Posts: 1,748

Original Poster
Blog Entries: 11

Rep: Reputation: 233Reputation: 233Reputation: 233
I was a bit in a hurry writing this thread. So I just wrote pear script. What I meant was the pear bash script. ( Doesn't sound good either )

If I just echo '@'php_bin'@' before the if block it just prints
Code:
@php_bin@
but the trail with pear config-show seems good. If you grep for it you get the line
Code:
PHP CLI/CGI binary             php_bin          /usr/bin/php
One can also find the other '@'var_name'@' from the bash script within the output of pear config-show. So I concluded its some internal variable substition. Maybe when pear is called from within pear or the user has a config file on its own (also I doubt later cause no config file is parsed...)

Thanks to the both of you I'm all set and my nosiness is satisfied
Cheers Zhjim

Last edited by zhjim; 11-02-2009 at 02:34 AM. Reason: typo edit
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
script using "/usr/bin/cat error" produces "cannot open" in cron Dcrusoe Programming 6 07-22-2009 03:30 PM
PHP 5.2.6 "make test" zend test failures mlnutt Linux - Server 0 05-07-2008 02:25 PM
LFS 6.2 Ch. 6.14 - 2nd Coreutils test returns "/bin.bash: No such file or directory" 0graham0 Linux From Scratch 2 08-23-2007 06:32 PM
Receiving constant error "Missing Dependency: /usr/bin/php is needed" GreenDragonComputers Linux - Software 3 05-09-2007 01:40 AM
problem "make"ing gtk+ "/usr/bin/env: perl -w" caid Linux - Newbie 8 07-29-2005 04:51 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:17 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration