Install pcntl extention on cent os 6.5 php 5.4.28 - php

I have dedicated server on bluehost having CentOS 6.5 and PHP 5.4.28
I have an issue with regards to starting a service on specific port no. I log in from PuTTY as the root user, go to home/fleeton/public_html/socket, and give the following command:
php -q server.php
server.php has script to start service on port no 10000
After executing the above command, it shows me:
This example requires PCNTL extention
Can you help me what steps I need to follow to install it?

For php 5.4.x and centos 6.5 64, try this.
First you will need php-devel and gcc if don't have yet
yum install php54w-devel
If you don't have gcc
yum install gcc.x86_64
download php source code for your php version, you have installed on your server, for example php-5.4.xx.tar.gz from http://www.php.net/releases/
cd php-5.4.xx/ext/pcntl
phpize
./configure
make
copy the extension to modules folder, first find the location
php-config --extension-dir
cp modules/pcntl.so /usr/lib

Related

How to run "brew" command in windows..?

It shows "'brew' is not recognized as an internal or external command" in windows command prompt.
I am trying to install codeigniter-reactjs-example from github, where first command is brew.
How to run this command to install that project in Windows..?
Edit: Homebrew is also usable on Windows Subsystem for Linux (WSL) since version 2.0.0 (released February 2019), as detailed by #VonC's answer below. The instructions for installation/use are available at:
https://docs.brew.sh/Homebrew-on-Linux
Homebrew is MacOS only command line installer application and it doesn't exist for Windows.
The Windows alternatives are:
Chocolatey
Npackd
Scoop
OneGet for Windows 10
Source: https://laracasts.com/discuss/channels/laravel/homebrew-install-on-windows-os
It shows "'brew' is not recognized as an internal or external command" in windows command prompt.
Not anymore, 19 months later (Feb. 2019, compared to July 2017)
At least, not on Windows 10, in a WSL (Windows Subsystem for Linux) session.
As mentioned by Mike McQuaid
Homebrew 2.0.0 has been released (at #FOSDEM!) with official Linux and Windows 10 WSL support, brew cleanup running automatically (opt-out with HOMEBREW_NO_INSTALL_CLEANUP), no more options in Homebrew/core and no longer running on OS X 10.8 and older.
See Homebrew 2.0.0.
“Homebrew on Linux” is called “Linuxbrew”.
You can install it in your home directory, so it does not require sudo, and use it to install software that your host distribution’s package manager does not provide.
Linuxbrew uses its own repository for formulae: Linuxbrew/homebrew-core.
So again, this is not native Windows support, but Linux (through the WSL layer, on Windows 10).
As mentioned in the comments, Homebrew is a package manager for OSX, much like Aptitude in linux. You can't install Homebrew on Windows and never will be able to so you need to find a new way to accomplish what you are doing. I think you're trying to work with Google's V8 Javascript engine so why not try:
https://github.com/phpv8/v8js
You can Install Brew on windows subsystem i.e in Ubuntu or Kali linux by following these steps.
1: $ sudo apt-get install build-essential procps curl file git -y
2: $ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
3: $ echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"' >> /home/$USER/.profile
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
4: $ brew update
I have installed in both the linux(Windows subsystem)
To Upgrade
$ brew upgrade PACKAGE
To Uninstall
$ brew uninstall PACKAGE
Finally, if you ever want to remove Homebrew from Linux, the command is:
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)"
Homebrew is a package manager for OS X. Windows can't use Homebrew. Even if there was a way to get pass that, the packages wouldn't work.
This link below might help you find an alternative.
http://alternativeto.net/software/homebrew/
Use this
Download git bash
Run below command, this will install homebrew to your PC
now this can help you run brew command
bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
If you want to run directly without bash then It can be done using cmd also
If following with cmd then you need to add the location of homebrew downloaded folder to your environment path variables
Try this in windows CMD
curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh
Now add this folder location "C:\Users\[NAME]\homebrew\" to path variable
TO add in Path Variables Follow below:

Where to find exectuable ./configure - PHP Debian

I need to install a module in PHP (OCI8), and to do so, I'm required to configure php with:
./configure --with-oci8=shared,instantclient,/path/to/instant/client/lib
(Extracted from http://php.net/manual/en/oci8.installation.php)
However I can't find the location of ./configure for php... I just need its location.
I'm on a Debian 8 Machine, with Apache2.
Thanks very much!
You can easily do this using the pecl instalation
sudo pecl install oci8
I assume that your using a Debian based linux.
The procedure to install a PHP module is classically compose of 4 steps :
phpize
./configure
make
make install
Your missing command is phpize, which will generate the ./configuration file required for your environment.

how to install old version php 5.3.26 on centos 6.5

Can anyone provide me a guide to install old version of php 5.3.26 on centos 6.5?
I have installed httpd through yum install -y httpd.
Go there :
https://github.com/php/php-src/tree/PHP-5.3.26
Download as zip.
Unzip on your server.
Now, configure your PHP. This is where you customize your PHP
with various options, like which extensions will be enabled. Do a
./configure --help for a list of available options. In our example
we'll do a simple configure with Apache 1 and MySQL support. Your
path to apxs may differ from our example.
./configure --with-mysql --with-apxs=/www/bin/apxs
And compile : make && make install
There are plenty of informations about this in the INSTALL file in the folder you unzipped

How can I update my PHP 5.3.3 to PHP 5.3.8 Linux Centos

I want to update my php 5.3.3 to php 5.3.8, I already downloaded PHP5.3.8.tar.gzip.
My PHP 5.3.3 located in /usr/bin/php. When I try to install PHP5.3.8.tar.gzip and do this command:
./configure
make
make install
It installed in different location /usr/local/bin/php.
So now I have 2 php 5.3.3 and php 5.3.8. So I try to install it again and run this
./configure -prefix=/usr/bin/php
make
make install
This time an error occurred:
Installing PHP SAPI module: cgi
mkdir: cannot create directory `/usr/bin/php': File exists
mkdir: cannot create directory `/usr/bin/php/bin': Not a directory
make: [install-sapi] Error 1 (ignored)
Installing PHP CGI binary: /usr/bin/php/bin/
cp: accessing `/usr/bin/php/bin/#INST#29239#': Not a directory
make: *** [install-sapi] Error 1
Please help me, I want to delete the php5.3.8 I installed in /usr/local/bin/php
and update the /usr/bin/php to php5.3.8. I need php5.3.8 version only.
Thanks.
Generally on CentOS, you want to leave this sort of thing to yum.
yum update php
or
sudo yum update php
You can also replace the installation with a newer version. 5.3.X is not supported any longer, so you could do:
yum install yum-plugin-replace
yum replace php --replace-with php55
If you don't have php 5.5 in yum, first do this:
cd ~
wget http://dl.iuscommunity.org/pub/ius/stable/CentOS/6/x86_64/epel-release-6-5.noarch.rpm
wget http://dl.iuscommunity.org/pub/ius/stable/CentOS/6/x86_64/ius-release-1.0-11.ius.centos6.noarch.rpm
rpm -Uvh epel-release-6-5.noarch.rpm ius-release-1.0-11.ius.centos6.noarch.rpm
If you don't have wget installed:
yum install wget
PLEASE NOTE FOR ALL OTHERS FINDING THIS THROUGH GOOGLE!!!
The URL's that I linked in the wget commands are the current releases of the epel and ius repos for CentOS 6. (It may also be out of date.)
If you have RHEL or CentOS 5, you can find the specific link for your RPM here: http://dl.iuscommunity.org/pub/ius/stable/
Why do you need 5.3.8 specifically? The last version of 5.3 was 5.3.27. 5.3 is end-of-life. I would find a modern repo like remi and install 5.4 or later using yum

Enabling PostgreSQL support in PHP on Mac OS X

I'm having a terribly difficult time getting the command "pg_connect()" to work properly on my Mac. I'm currently writing a PHP script (to be executed from console) to read a PostgreSQL database and email a report.
I've gone into my php.ini file and added
extension=pgsql.so
But, I'm met with the following error.
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/extensions/no-debug-non-zts-20090626/php_pgsql.so' - dlopen(/usr/lib/php/extensions/no-debug-non-zts-20090626/php_pgsql.so, 9): image not found in Unknown on line 0
PHP Fatal error: Call to undefined function pg_connect() in... (blah file here)
When running phpinfo(), I see nothing about PostgreSQL, so what is my issue here?
The PHP version that comes bundled with OS X doesn't include PostgreSQL. You'll have to compile the extension yourself. Here are some instructions:
Find your version of PHP: php -v.
Download the version of PHP that matches yours: curl -O http://us.php.net/distributions/php-5.3.3.tar.gz. (This example downloads PHP 5.3.3 but this must match your version)
Extract the archive you downloaded: tar -xzvf php-5.3.3.tar.gz
Change to the PostgreSQL's extension directory: cd php-5.3.3/ext/pgsql/
Type phpize.
Type ./configure.
Type make.
Type sudo make install.
Add the extension to you php.ini file by adding extension=pgsql.so. (You may already have done this)
Restart Apache.
Update for OS X Mountain Lion
Apple has removed autoconf from the newer versions of XCode so the procedure above will fail at #5. To solve that problem:
Type /usr/bin/ruby -e "$(/usr/bin/curl -fksSL https://raw.github.com/mxcl/homebrew/master/Library/Contributions/install_homebrew.rb)".
Type sudo chown -R $USER /usr/local/Cellar.
Type brew update.
Type brew install autoconf.
That should install autoconf and allow you to install the module using the instructions above.
If you use home brew, you can solve this with a command as simple as:
brew install php55-pdo-pgsql
for other php version, search with:
brew search pgsql
This worked for me with OSX 10.9.4 «Mavericks»
Install sources
Download the PHP source code. Unlike on Mountain Lion, you don’t get any headers preinstalled to link against so need to put it in /usr/include/php. Mavericks ships with PHP 5.4.17, but the latest 5.4.x source from php.net should do:
tar -jxvf php-5.4.20.tar.bz2
sudo mkdir -p /usr/include
sudo mv php-5.4.20 /usr/include/php
Configure PHP
cd /usr/include/php
./configure --without-iconv
sudo cp /etc/php.ini.default /etc/php.ini
Building a module
I needed the pdo_pgsql module - the same pattern should apply to just about any module assuming you have the necessary dependencies installed:
cd ext/pdo_pgsql
In my case I had the following error:
Cannot find autoconf. Please check your autoconf installation and the
$PHP_AUTOCONF environment variable. Then, rerun this script. ERROR:
`phpize' failed
So I had to use this command:
brew install autoconf
Then:
phpize
After that I tried to do:
./configure
but I had the next problem:
checking for pg_config... not found configure: error: Cannot find
libpq-fe.h. Please specify correct PostgreSQL installation path
So the solution was to specify correct PostgreSQL installation path:
./configure --with-pdo-pgsql=/Library/PostgreSQL/9.3/
make
sudo make install
That copies pdo_pgsql.so to /usr/lib/php/extensions/no-debug-non-zts-20100525.
Then simply add
extension=pdo_pgsql.so to /etc/php.ini
Run php -m to confirm everything went to plan.
For those who installed php7/ngix/postgres with homebrew
You can install the PostgreSQL module with:
brew install php70-pdo-pgsql
After that, you have to restart the php service:
brew services restart php70
OS X El Capitan users can simply upgrade their version of PHP 5.6. This is a one liner that will do that.
curl -s http://php-osx.liip.ch/install.sh | bash -s 5.6
For php56 via brew:
brew install php56-pdo-pgsql
PostgreSQL by default is installed in a unusual place on MAC OS X:
/Library/PostgreSQL/9.3
Given the location above you can type this:
./configure --with-pgsql=/Library/PostgreSQL/9.3
I killed the whole day trying to make it work on El Capitan after I made an upgrade yesterday and it turned out that I forgot to modify httpd.conf and change the path from the default php module (version 5.5.27) to the one I installed (version 5.6.14). This should be done in httpd.conf by modifying your default LoadModule php5_module path to LoadModule php5_module /usr/local/opt/php56/libexec/apache2/libphp5.so.
Just decided to leave it here as the potential solution for those who upgrade their OS or just the PHP version and face the same problem.
For those of you having openssl error while make here is the solution
OSX uses openssl 0.98 while installer is searching for 1.0.0
refer this link for instructions
psycopg2 installation error - Library not loaded: libssl.dylib
I downloaded PostgreSQL for Mac, and used the stack builder after installation to standup the entire EnterpriseDB Apache/PHP stack end-to-end. I mention this as a possible time saving option, probably not ideal for all situations. Should work OK if the apache and postgres shipped with Mac OS X were never started.
To keep existing apache hosted applications (i.e. pre-PostgreSQL install legacy) stable, I would just install the newer EnterpriseDB apache on port 81 (stackbuilder will prompt for new port if legacy apache instance is already running). Then, use mod_proxy in httpd.conf for the apache running on port 80 to provide seamless user experience to applications hosted on PostgreSQL.

Categories