I use Windows Server 2012 and PHP 5.3.13.
PHP is installed fine, and I try to install pear now.
I ran the go-pear.bat and keep hitting Enter, (using the defaults I guess).
Then ran the PEAR_ENV.
I checked the environment vars and chenged the values of PHP_PEAR_PHP_BIN to C:\Program Files (x86)\PHP\php.exe, where my php.exe lives. Both for Admin and System vars.
Now, when I type pear to command line I get the message syntax error, unexpected '(' in Unknown on line 14. I click OK and I get the options for pear.
I guess is caused because of the (x86) part in the values?
If I go to the website I am working, PHP cannot connect to the database. Is that a pear's fault? Or is another issue?
Thanks in advance
PS
Inside php.ini, the only line that is not a comment and has to do with include_path is this one include_path=".;C:\Program Files (x86)\PHP\pear"
This is caused because PHP “incorrectly” processes a line.
Open the pear.bat file find the following line, at the bottom
"%PHP_PEAR_PHP_BIN%" -C -d output_buffering=1 -d safe_mode=0 -d open_basedir="" -d auto_prepend_file="" -d auto_append_file="" -d variables_order=EGPCS -d register_argc_argv="On" -d include_path="%PHP_PEAR_INSTALL_DIR%" -f "%PHP_PEAR_INSTALL_DIR%pearcmd.php" -- %1 %2 %3 %4 %5 %6 %7 %8 %9
and replace the include_path="%PHP_PEAR_INSTALL_DIR%" part with "include_path='%PHP_PEAR_INSTALL_DIR%'"
The double quotes keeps shell happy, while the single quotes are for PHP to use.
Taken from Nasir's blog here. Worked for me
Related
i am using laravel on docker . i run my project when i exec into container and use
php artisan tinker
no matter what command i run i receive this error :
bash-5.1$ php artisan tinker
Psy Shell v0.11.8 (PHP 8.0.14 — cli) by Justin Hileman
>>> App\Models\User::where('id',12)->first()->createToken('testToken');
/usr/bin/less: unrecognized option: X
BusyBox v1.34.1 (2021-11-23 00:57:35 UTC) multi-call binary.
Usage: less [-EFIMmNSRh~] [FILE]...
View FILE (or stdin) one screenful at a time
-E Quit once the end of a file is reached
-F Quit if entire file fits on first screen
-I Ignore case in all searches
-M,-m Display status line with line numbers
and percentage through the file
-N Prefix line number to each line
-S Truncate long lines
-R Remove color escape codes in input
-~ Suppress ~s displayed past EOF
RuntimeException with message 'Error closing output stream'
any idea what can be wrong here ?
Busybox contains cutdown versions of many Unix/Linux utilities, including less. Either remove it and install the less package, as well as the other utilities it mimics, or hack artisan and remove the -X switch against /usr/bin/less. All the -X switch does is sort alphabetically by entry extension
Ugh just spent a ton of time messing with this one myself.
The root cause of this issue is the upgrading of the psypsh shell package that tinker users.
You can see in the release notes here https://github.com/bobthecow/psysh/releases/tag/v0.11.3
There are a few ways around this, as mentioned above, you can just install the less package using apk or apt-get.
You can also set the cli.pager property in your php.ini file to explicitly call less without the -X switch.
More info here: https://github.com/bobthecow/psysh/issues/717
I was using XAMPP, and added a XAMPP sub-directory to my PATH in ~/.bash_profile, and now for some reason all of a sudden /Applications/XAMPP is my home directory (e.g. when I type "cd ~" and do "ls", it only lists the contents of the XAMPP folder. And because of this, I can't find my ~/.bash_profile to revert the PATH back to normal. It seems to have disappeared. Any suggestions?
I'm not completely sure what causes you to end up in /Applications/XAMPP. But I can tell you a way to debug a login shell:
PS4='+ $BASH_SOURCE:$LINENO: ' bash -xlic ''
-x is for debug, -l is login, -i is interactive, and -c '' is a NOP command.
PS4 will be appended on each line printed by -x, and in our case it will print file and line number from where the code is executed.
I have this script that works correctly (if run via terminal manually)
#!/bin/sh
unset DISPLAY
scriptname=$1
[ -f "$scriptname" ] && scriptname=$(winepath -w "$scriptname")
wine "C:\Program Files (x86)\Inno Setup 5\ISCC.exe" "$scriptname" "/q"
Ubuntu Server with Apache, PHP
Wine installed with Inno Setup 5 in folder Program Files (x86)
ISS File: "/home/www/files/iss/Example.iss"
Script SH: "/home/www/iscc.sh"
1a - If I access the terminal via SSH and run the file "iscc.sh" passing the file location. "Iss" as a parameter, the build is done correctly without problems.
2a - If I run all the commands in a single line (inline), the compilation is also done correctly without problems.
1b - "/home/www/iscc.sh" "/home/www/files/iss/Example.iss"
2b - unset DISPLAY && scriptname="/home/www/files/iss/Example.iss" && [ -f "$scriptname" ] && scriptname=$(winepath -w "$scriptname") && wine "C:\Program Files (x86)\Inno Setup 5\ISCC.exe" "$scriptname" "/q"
But the problem is the following, via PHP, if I use the command shell_exec or exec or system, none of them run properly.
What can be causing these failures, can someone help me with this problem? I do not understand why not compile.
I'm trying to execute a PHP script on Windows through php.exe, while passing parameters to the script. Everywhere I look, it says it should work like this:
php -f "path\to\my\script.php" -- -t 10 -i 5
The -t 10 -i 5 should be passed to script.php, where I can access them through $argv. When I type this in on the command line, everything runs as expected. When I paste the very same line in a .cmd file, the part after script.php gets treated as a seperate command. (and yes, it is a single line in the batch file)
C:\>php -f "path\to\my\script.php" -- -t 10 -i 5
<<<output of the php script as expected>>>
C:\>mybatch.cmd
C:\>php -f "path\to\my\script.php"
<<<output of the php script not receiving the parameters>>>
C:\>-- -t 10 -i 5
'--' is not recognized as an internal or external command, operable program or batch file.
I first thought it might be a problem with the --, but even if I leave out the -- (basically passing the other parameters to php.exe instead of to the script), the same problem occurs.
Any ideas on why this is happening?
Found the problem, appearantly there was a linefeed after the filename of the script, but that was not visible in notepad. No idea how it got there (probably copy/paste related), but removing it fixed the problem.
I'm trying to use phpDocumentor (for the first time, I have no idea what I'm doing).
Actually, I want to use it only with SublimeText 2 and this plugin. Can you guide me step by step what should I do to make it working?
Here's what I've done now: (I'm using Windows 7)
Downloaded phpDocumentor from here and placed it somewhere.
I've created system PATH's for phpdoc/bin (so phpdoc.bat can be executed by sublime plugin) and then also added system path to php (from WAMPserver installation)
When I try to use my plugin (or execute phpdoc inside console window) I get this error:
Could not open input file: \phpdoc.php
Run:
pear
it will set %PHP_PEAR_PHP_BIN% for you.
You will need to set the environmental path for "PHP_PEAR_BIN_DIR" to the directory where "phpdoc.php" is.
I have changed phpdoc.bat file to point to exactly location of phpdoc.php
#echo off
if "%PHPBIN%" == "" set PHPBIN=php.exe
if not exist "%PHPBIN%" if "%PHP_PEAR_PHP_BIN%" neq "" goto USE_PEAR_PATH
GOTO RUN
:USE_PEAR_PATH
set PHPBIN=%PHP_PEAR_PHP_BIN%
:RUN
"%PHPBIN%" "C:\wamp\bin\php\php5.3.10\phpdoc.php" %*
On my windows 7 system, I have my set up phpDocumentor (version 2.6.1) in wamp and my paths are like:
D:\Projects\wamp\www\phpDocumentor
D:\Projects\wamp\www\phpDocumentor\bin
Now what I did is I edited the phpdoc.bat file located at path:
D:\Projects\wamp\www\phpDocumentor\bin\phpdoc.bat
It contained code as shown below:
#echo off
if "%PHPBIN%" == "" set PHPBIN=php.exe
if not exist "%PHPBIN%" if "%PHP_PEAR_PHP_BIN%" neq "" goto USE_PEAR_PATH
GOTO RUN
:USE_PEAR_PATH
set PHPBIN=%PHP_PEAR_PHP_BIN%
:RUN
"%PHPBIN%" "D:\Projects\wamp\www\phpDocumentor\bin\phpdoc" %*
So, I edited the last line "%PHPBIN%" "%PHP_PEAR_BIN_DIR%\phpdoc" %* with new code "%PHPBIN%" "phpdoc" %*. After phpdoc.bat looked like :
#echo off
if "%PHPBIN%" == "" set PHPBIN=php.exe
if not exist "%PHPBIN%" if "%PHP_PEAR_PHP_BIN%" neq "" goto USE_PEAR_PATH
GOTO RUN
:USE_PEAR_PATH
set PHPBIN=%PHP_PEAR_PHP_BIN%
:RUN
"%PHPBIN%" "phpdoc" %*
Thereafter I again ran the below command in cmd:
D:\Projects\wamp\www\phpDocumentor\bin>phpdoc
And the output was like:
D:\Projects\wamp\www\phpDocumentor\bin>phpdoc
Collecting files .. OK
Initializing parser .. OK
Parsing files
[Exception]
No parsable files were found, did you specify any using the -f or -d parame
ter?
project:run [-t|--target[="..."]] [-f|--filename[="..."]] [-d|--directory[="..."
]] [--encoding[="..."]] [-e|--extensions[="..."]] [-i|--ignore[="..."]] [--ignor
e-tags[="..."]] [--hidden] [--ignore-symlinks] [-m|--markers[="..."]] [--title[=
"..."]] [--force] [--validate] [--visibility[="..."]] [--defaultpackagename[="..
."]] [--sourcecode] [-p|--progressbar] [--template[="..."]] [--parseprivate] [--
log[="..."]]
D:\Projects\wamp\www\phpDocumentor\bin>
So, the output showed that it worked successfully !!
PHP's include_path will need the path to the directory that contains that phpdoc.php file. Otherwise, none of the phpDocumentor code that uses require/include statements with relative paths will be able to find anything.
I just encountered this on Windows 7 having installed phpDocumentor2 via PEAR. I found that running:
phpdoc -d . -t docs
in an elevated command prompt did the trick - I suspect there's still some PATH issue on my machine that makes that the case, but having done all the default install steps for both PEAR and phpDocumentor it has proven the quickest workaround I've found.
I've got the same error message, the already made answers brought me to the right path.
As I don't use wamp/xampp or any of these programms, I thought: why don't run it directly with PHP?
I had already installed PHP7.0.x globally through WebPI.
Only php needs to be prefixed to the command, everything worked:
php .\phpDocumentor\bin\phpdoc -d .\src\ -t .\dst\