First off I am not sure if I am at the right place or better at serverfault.
I am working on a PHP project and need access to an Oracle 10g DB. The server I am using is provided and maintained from a 3rd party. Lets call them ABC. I have only a restricted user. So everytime I need something I have to ask them to install it. This worked fine until now.
The server is a RedHat server and ABC is only allowed to install software from the official repositories. We were able to install the Oracle Instant Client but did not find the PHP libraries within the repository.
Our second try was to find a rpm-package containing the OCI8 library which is compatible with the installed software. Unfortunatly we only found a version which needs a newer PHP version which, you guessed it, is not part of the official repository.
Okay, I checken php.net and they told me that I would be able to compile it myself as a shared library. Neat, that would be enough. The problem here is that i am not able to run the phpize command as locking failes (in terms of blocks) the process. The root-User from ABC would be able to do it, but they are not allowed to compile anything.
So here I am asking you guys if there is a way to download the files and use it as a shared library without installing, compiling or whetever. The server is a 64bit RedHat Enterprise 6:
Linux [SERVERNAME] 2.6.32-358.11.1.el6.x86_64 #1 SMP Wed May 15 10:48:38 EDT 2013 x86_64 x86_64 x86_64 GNU/Linux
Any help is highly appreciated!
Thanks,
Alex
I found a way:
1. Set a proxy for pear:
pear config-set http_proxy http://[proxy]:[port]
2. Get sudo rights to use pecl
3. Install:
sudo pecl install oci8
Related
Background:
1. How can i install gearman php extension on Windows OS?
2. Installing gearman PHP extension on Windows using cygwin and pecl
Following the answer in 1. question, I've made my cygwin work, downloaded and compiled gearman, and got the first gearman worker example to work:
Problem:
To run the same example from PHP script, I still need PHP extension. Somewhere I've seen that I might get to install PECL extension using PEAR, so:
I've downloaded go-pear.phar into C:\...\php5.6.16
ran php go-pear.phar
installed PEAR in system mode -> success
Now I can do: C:\...\php5.6.16>pecl install gearman which gives:
WARNING: channel "pecl.php.net" has updated its protocols, use "pecl
channel-update pecl.php.net" to update
downloading gearman-1.1.2.tgz ...
Starting to download gearman-1.1.2.tgz (30,961 bytes)
.........done: 30,961 bytes
3 source files, building
ERROR: The DSP gearman.dsp does not exist.
Which would indeed be a sorcery if it worked, as that extension should be probably built/compiled accordingly to PHP itself. What is the least painful way to make this work? Is there a way how to do this without installing Visual Studio? I've also seen Net_Gearman PEAR package that might perhaps be wrapped / tweaked to be used just as the PECL one?
I'm currently using WAMP3.1.1 with PHP5.6.16 it comes with + VC15 x64 Thread Safe PHP7.2.2, need Gearman to work with at least one of those two. Any help appreciated
I've followed these 2 guides:
https://www.sitepoint.com/compiling-php-from-source-on-windows/
https://wiki.php.net/internals/windows/stepbystepbuild
1. I've downloaded:
Visual Studio 2012
.NET Framework 4.7.1 (which at the end just flashed a message that it's already installed)
Windows SDK _X_EN_DVD.iso
php-sdk-binary-tools-20110915.zip
deps-5.6-vc11-x64.7z (dependencies)
php-src-php-5.6.16.zip (GitHub release)
2. Compiled PHP
(note this is all from Native Tools Command Prompt, I didn't even actually start VS at all)
used just configure --disable-all --enable-cli --enable-pdo
3. Tried to compile PECL Gearman
found out it can't really be done on Windows
4. Found Gearman wrapper for Windows:
mhlavac/gearman on GitHub
The thing is I have here a group of web developers and everyone works with WAMP in Windows. In there they work with a php extension called php_websockets. Basically in php.ini they just uncomment ;php_websockets.dll and voila.
On the other hand I work with Linux (CentOS 7 in this case), and there's no possible way I can find php_websockets in any php.ini or conf archives.
I know there are a lot of web sockets out there. But they insist me it must be this one.
Not sure if there are multiple "php websockets" projects out there; finding out the version number of the one they are using might help. Assuming it's this one: http://sourceforge.net/projects/phpwebsockets/, there are linux installation instructions at http://sourceforge.net/projects/phpwebsockets/files/:
LINUX INSTALLATION - Tested and works on the following systems:
- Fedora Core 17 PHP-5.4.9 x86_64
- Fedora Core 18 PHP-5.4.10 x86_64
- Fedora Core 18 PHP-5.4.12 x86_64
Build it from source - Simply unpack the files and at a shell prompt type these commands.
# phpize
# ./configure --enable-websockets
# make
# make install
# cp websockets.ini /etc/php.d/
If all went smoothly, websockets should be installed and working.
If you have any issues, please post them in the sourceforge ticket system
https://sourceforge.net/p/phpwebsockets/tickets/
NOTE: You will have to re-build if you update PHP
Documenting my struggles to help others and hopefully get some feedback on how I could have done it better.
The command pecl install pthreads fails due to the php installed on my ubuntu 13.04 box not having zts configured.
Options:
1) The ubuntu respository does not have a php package with zts enabled. As of this post, ubuntu only has php 5.4.9 in it's repository (Released: 22 Nov 2012). It is possible to compile a php version from source - which I eventually did (see below), but..
2) I .. ALSO .. wanted to use phpfarm for the ability to run different versions of PHP on my local setup. On github, there is Christian Weiske's original contribution here (phpfarm) and a fork that he has contributed to, by François Poirotte - also called phpfarm. Francois' fork has a few more options to configure ('post-install customization') but I was not able to make that work with a PECL extension. I'm curious to know if misunderstood how to do that, because it looks to me that it just simply does not take PECL commands.
3). Prior to recompiling php from source, I loaded phpfarm (tried both versions), enabled php-fpm (FastCGI) and was able to get my apache2 server to use a phpfarm version (5.5.10) which showed up in a phpinfo() output. But the php-cli always showed the original php version (5.4.9) in the cli (run: php -v). Running (run: php -i | grep php.ini) showed /etc/php5/cli but I had previously removed php5 and aptitude show php5 returned a state of 'not installed.' I even renamed the /etc/php5 directory to see if I could force the system to use the phpfarm php version. Obviously, this is incorrect thinking and I went on to simply compile php 5.6 from source. But, is there something more to do to get a phpfarm php to be used in the cli? I read that the cli loads it's configuration file on a per command basis, unlike the apache2. If I could have run the 5.5.10 version (configured with zts) then I could have then done pecl install pthreads and then re-complied the phpfarm 5.5.10 version with pthreads enabled. Although it appears I will be able to run various versions of php in the apache server, will I ever be able to switch-phpfarm to another version and see it working in the php-cli? Also, I was uncertain on where I could have loaded a pthreads file for the phpfarm compile process to find and use it; could I have done it that way?
4) This stackoverflow post, essentially posted by Joe Watkins - the developer of pThreads is a perfect how-to on getting pThreads installed on a Ubuntu system that has had php configured with zts (Zend Thread Safety). (Thanks Joe!)
A nice tutorial on using phpfarm configured with fast-cgi and the apache server to help run websites under different php configurations.
So what gives with php, php-cli and the phpfarm?
I'm not sure about phpfarm, but do know of another solution ...
Multi
A tool for maintaining multiple installations of PHP in multiple configurations
https://github.com/datingvip/multi
This is a bit more user orientated, will allow you to build many configurations and versions of php, any tagged release of php, and any patched version from any fork of php-src.
In addition, because I wrote it, it will install pthreads for you.
git clone https://github.com/datingvip/multi
cd multi
VERSION=5.5.10 DBG=no-debug ZTS=zts ./php.multi
The above commands will yield an installation of PHP (in one suitable configuration, of one version) in /opt/php.
Look at php.defaults for configuration options and adjust before building
Should configuration fail on, for example, something related to a library like libxml2, it will usually be the case that
sudo apt-get install library-dev
Where library is replaced with the name of the library holding up the build, will fix the problem for you. If it does not, a quick google should get you going again.
Once the build is complete
source /path/to/multi/php.env 5.5.10
Note: multi will always install pthreads for any zts version automatically
I hope that gets you somewhere ...
I'm attempting to add the gettext() extension to the PHP build, the installation instructions are not very clear:
To include GNU gettext support in your PHP build you
must add the option --with-gettext[=DIR] where DIR is the
gettext install directory, defaults to /usr/local.
Where do i place this option, and in which file? (I have never configured PHP before)
Is Apache restart required? If so, how long does it take and what are the dangers?
I have not installed gettext myself, it looks to be preinstalled on my system:
# rpm -qi gettext
Name : gettext Relocations: (not relocatable)
Version : 0.17 Vendor: CentOS
Release : 16.el6 Build Date: Thu 11 Nov 2010 04:06:25 AM EST
Install Date: Tue 30 Jul 2013 03:03:04 PM EDT
The gettext extension is installed by default, but not its PHP bindings. Install package php-gettext to add those to your system. The package manager will handle all other bindings for you, and probably even restart Apache for you. On a normal system in a normal situation that takes less than a second, and your users won't notice anything since Apache gracefully waits for existing requests to finish when shutting down.
Ignore the install notes in the PHP manual when not running a self-compiled version of PHP - on systems like Debian, Ubuntu, CentOS etc. the package manager will handle most common tasks like this for you in a safer way.
The comment in the instructions is directed towards compiling from source.
Like Niels wrote, package manager should do the job and take care of all missing dependencies. Since your system is CentOS try this:
yum install php-gettext
I come to this question with the php-build tool. In case to compile with php-build tool and would like to add the custom configuration, you can configure it in /usr/local/share/php-build. (Ubuntu), it may in another directory up to your platform.
Go there and edit file default_configure_options and put any custom configurations as you wishes.
ex.
--with-gettext=/usr/bin
I need to deploy Zend Framework app on Ubuntu.
I've downloaded Ubuntu desktop, installed using apt-get apache+php+mysql,
but PHP turned out to be not the latest 5.3, but 5.2.1 and even
mysql extension is missing.
I understand I can get somewhere a fresh php installation, get dependent libs (like curl or libxml2) compile them one by one and then I get full-features latest PHP bundle.
But is there anywhere already full PHP bundle with latest version and all libs to get
ZF app running very quickly?
One of the downsides of package management is that you're at the mercy of the package maintainers. Ubuntu has opted not to update to PHP 5.3 in this version, so you'll have to either wait until 2010 for it or compile PHP yourself.
Most of the PHP extensions that arent in a default source build directly from PHP are in seperate apt packages. If you do a search for PHP5 in you package manager youll see packages like:
PHP5
PHP5-Mysql
PHP5-cli
PHP5-SQLite
etc..
Im going to assume that there are also packages specifically for php 5.3 - most likely labeled as php53-* or something similar. You may need to adda repo for this as im not sure its in the crore repos.
Anyhow you need to isntall all these packages that you need to use.
I ran into similar issues getting the latest PHP on my CentOS server. I installed Zend Server Community Edition, which sets up it's own Apache/PHP5.3 stack in /usr/local/zend. And here's a Getting Started article.
It's a full PHP bundle.
If you need other packages for Ubuntu, check the ubuntu repository for PHP5 at http://bg.archive.ubuntu.com/ubuntu/pool/main/p/php5/