I need use composer for a project on any servers.
This server has a very old PHP version on system.
But i don't need to use Cpanel PHP version.
I need for my own program use Cpanel internal version locate at /usr/local/cpanel/3rdparty/php/54/
I try modify shebang
Original
#!/usr/bin/env php
Changed
#!/usr/local/cpanel/3rdparty/php/54/
But not work.
If /usr/local/cpanel/3rdparty/php/54/ includes a php binary you have to give that path to shebang:
#!/usr/local/cpanel/3rdparty/php/54/php
Also you should be able to call /usr/local/cpanel/3rdparty/php/54/php composer.phar.
Related
IE, does PHP use its own, internal version of cURL or does it use whatever it finds in the local OS (Windows 10)? I'm in the unfortunate position of trying to make scripts written in 7.4 work on a permanent home that's saddled with 7.1. Before I force an update of PHP, I want to make sure chasing the right problem. I've searched php.ini and don't see a path to the local file system.
Thanks!
The curl functions in PHP do not call out to a command-line version of curl, but rather to a library which can be integrated into a C program.
This version may be included "statically" when PHP is compiled, be a separate file installed alongside PHP, or use a shared file installed centrally on the server and used by multiple programs. This will be determined by the distribution package of PHP.
To determine the library version used, use the phpinfo() function, or run php -i on the command line (which just runs that function for you) and search for "curl", which will show the version.
I'm not sure what your question is.
IE is not an issue here.
I always keep a script that gives me the current state of PHP.
PHP Manual, phpinfo()
<?php
phpinfo();
?>
phpinfo will return something like this if curl is (likely) installed.
I learned through the process of installing PHP 8.1 in my dev env and configuring it to use curl (and a comment), that PHP does call it's own curl executable, in the case of windows 10: php_curl.dll, and does not make an external call to curl in the operating system.
My fear was I'd go through the process of getting someone to upgrade PHP then have to have ask, again, to have curl upgraded.
Thanks to all who offered input!
yes, but curl is an extension, you need to enable it in php.ini file
I have a hosting plan through Godaddy that only supports python 2.6.6. I have been able to install python 2.7 and 3.6 through SSH and run scripts, pip, no problems.
When I try and run a PHP script that calls a python script from SSH, it works just fine using my new python installs, but when I open the PHP script in a browser, it will only run 2.6.6.
Why is this? Is there a way to get around this without getting a VPS?
I think what is happening here is that you are able to manually run Python3 from your SSH session by calling it directly.
However, your PHP installation probably isn't aware that you have more than one instance of Python installed. At a guess, your PHP installation is defaulting to it's environment path (or other predetermined library directory) where it can find a Python installation (this installation being the original 2.7).
I'm not sure how you are calling your Python scripts but there is an answer here: Calling specific version of python from PHP that talks about changing the python version in the script.
Another possible solution is to add the directory containing Python3 to your $PATH variable. Word of warning, if this is a shared system this might be disabled or potentially COULD get you in some trouble. Since altering the path might start other python scripts (belonging to other people) being called by Python3, which could break them (due to deprecated syntax etc)
When you want to start messing with system configuration, you're getting into VPS territory rather than shared hosting.
I have found a sneaky way around this. I used SSH2 PHP extension to call the python3.
So basically i am trying to run yii-framework on wamp server but required higher version of php (5.4 above). In my Wamp server, the php version is 5.5 which i have checked on browser (localhost). But the when i run it on windows, it fails because the windows version is only 5.3. It causes the yii framework fail too because when i type php requirements.php. it does not work.
There is no Windows version of PHP so basically you must have installed a version of PHP manually i.e. not with WAMPServer.
This will probably have added an entry on you PATH ( always a bad idea when using WAMPServer anyway as you can have many versions of PHP on your system at one time with WAMPServer)
Look at your PATH and if you must, amend it to point to the PHP in \wamp\bin\php\php{version}
A better way is to remove any reference to PHP from the PATH environmant variable and write a simple batch file to add php to your path only when you want to, like this
Batch file saved in C:\windows\phppath.cmd
echo off
PATH=%PATH%;c:\wamp\bin\php\php5.4.16
Assuming you have php5.4.16 on your wampserver install.
Yesterday, I installed Pear. During installation it asked me installation path of php. But, i mistakely entered different path. So, Pear installed different php version in that Path.
Problem
Now, my apache runs php v5.5 as always. But, from yesterday, command prompt runs v5.3!
How can I make changes so that command prompt runs same version as apache i.e. v5.5.??
I am using windows.
Edit your path variable, replacing the path to v5.3 with the path to v5.5. This guide provides some good info on how to edit the system path.
How does the PHP that MAMP uses run differently from the PHP installed on my Mac?
For example, if if place an bare "phpinfo()" file and access it through my browser into MAMP/htdocs .. the information supplied is my MAMP PHP setup, correct?
But if I terminal into that same folder and "php -i" from command line, I will get the details of my Mac's "system" PHP, correct?
So does that mean that extensions must be separately installed into both setups? Do they need to be managed as 2 completely separate entities? Any PEAR packages installed via command line will not be available to MAMP? If I want to keep the two synchronous I must "double" everything?
All user-installed versions of PHP are installed into a separate folder, keeping the original install of PHP intact. MAMP is only set up to use its version of PHP in the browser.
You can change this behavior by updating your PATH to use MAMP's version, if you don't care about the stock PHP version (which is fairly old). You can do that by adding the following line to your ~/.bash_profile (don't forget to double-check the exact path, so you get it right):
export PATH=/Applications/MAMP/bin/php5/bin/:$PATH
This will make all references to PHP use MAMP's version.
If you need to use the stock version of PHP for whatever reason and don't want to do the above, then you can create an alias. More details for creating command line aliases can be found in this related SO post.