PHP OCI8 installation on mac sierra - php

Is anyone know how to install PHP OCI8 extension on macOS Sierra (10.12.6)? I tried to follow the steps given here http://www.enavigo.com/2012/01/04/enabling-oracle-oci8-php-extension-on-os-x-snow-leopard/ but stuck on the step where it says copy files under /usr/include folder. Looks like copying to that folder is not allowed in new OS version? I tried googling but didn't find any good answer. All answers are related to old OS versions. Any help would be really appreciated

The Instant Client installation instructions for macOS say you can link from ~/lib (as an alternative to /usr/local/lib).
Unzip the Instant Client Basic & SDK packages to ~/instantclient_12_1 and then run:
mkdir ~/lib
ln -s ~/instantclient_12_1/libclntsh.dylib ~/lib/
This is what I do: just one symbolic link to my local Instant Client directory.
Now you can build PHP and/or OCI8. If you are using PECL and PHP 7 you could run
pecl install oci8
and answer the prompt with:
instantclient,/Users/yourname/instantclient_12_1
Don't use something like $HOME, since pecl won't expand variables.
If you are building PHP yourself, your configure option could be something like:
configure --with-oci8=instantclient,$HOME/instantclient_12_1 . . .

Related

How to load memcached on PHP in Mac OS X Catalina?

I have tried virtually everything I could for the last 3 hours. I just don't seem to get it to load on PHP. I was able to install it via brew install memcached and successfully make run it as a background service via memcached -d. But that's not really what I am looking for.
I am looking at loading it as one of my PHP modules. Running php -m on the terminal does not list memcached on it at all. Neither looking at phpinfo() or print_r(get_loaded_extensions()); on runtime gave me any luck. I am trying to officially access it in my project via something like extension_loaded('memcached'), of course, this returns a falsy value atm.
I have tried solutions like below:
How to install memcached module for php#7.1 on MacOS High Sierra?
https://donatstudios.com/OS-X-Mavericks-Memcached-PHP-Extension-Installation
Can I install the memcached PHP extension with PECL?
Most of the solutions are similar to the above linked. Unfortunately, this isn't working for me because of an issue similar to this:
Unable to use PHPIZE after update to MacOS Mojave
I also get below error when executing a make command:
make: *** No targets specified and no makefile found. Stop.
And the below error when running ./configure
checking for session includes... configure: error: Cannot find
php_session.h
Meanwhile, I also cannot attempt an install via pecl install memcached due to the error below:
configuration download directory "/tmp/pear/install" is not writeable.
Change download_dir config variable to a writeable dir to avoid this
warning
Basically everything just doesn't work. And honestly, I didn't even know how to start writing this question, so I'm just kinda throwing everything in here.
It doesn't help that there are no recent discussions about installing memcached on PHP since Catalina. A lot of resources are just 5 years old and that's not a good sign, a number of them aren't even valid solutions anymore.
I am losing my mind. Why this thing is so complicated to configure is beyond my comprehension. If someone can point me in the right direction that would be great!
So I was able to find a solution after 2 working days. What you should do is move away from using built-in Apache/PHP from macOS and use the ones from Homebrew.
Here are the descriptive step-by-step procedure I did:
1) Unload the built-in Apache.
2) Install a new Apache from Homebrew via brew install httpd and then run the service
3) Install PHP via brew install php
4) Configure httpd.conf from /usr/local/etc/httpd/, including loading Homebrew PHP module, mod_rewrite, setting up DirectoryIndex, ServerName, default Listen port, etc.
4.1) If you are using virtual hosts, set this up on /usr/local/etc/httpd/extra/
5) Configure ~/.bash_profile to use the new PHP version (test via php -v or which php)
6) Install PEAR
7) Install memcached via PEAR
I have compiled a list of links that you can use:
Apache & PHP Installation
https://tecadmin.net/install-apache-macos-homebrew/
https://getgrav.org/blog/macos-catalina-apache-multiple-php-versions
https://gist.github.com/DragonBe/0faebe58deced34744953e3bf6afbec7
Follow brew info php to configure Homebrew PHP to Homebrew Apache
Configure bash profile to use homebrew php by default
PHP --version shown incorrectly on osX
How to use the php that brew installed?
Install PEAR and configure
https://jasonmccreary.me/articles/install-pear-pecl-mac
Install memcached via PEAR
pecl install memcached then follow instructions
Or
How to install memcached module for php#7.1 on MacOS High Sierra?
https://donatstudios.com/OS-X-Mavericks-Memcached-PHP-Extension-Installation
Can I install the memcached PHP extension with PECL?
why don't you try vagrant box. You will get a virtual environment of your choice, install a ubuntu environment in minutes and you can get a LAMP or MEAN / MERN vagrant box ready made.
Steps :
1) Download and install virtualbox.
2) Download and install Vagrant
3) Go to terminal
Check if vagrant is installed or not.
vagrant -v
In order to get a ubuntu box spinning up, run these commands.
vagrant init ubuntu/trusty64
It will download you a ubuntu box in minutes.
vagrant up
vagrant ssh
Have a look at vagrant you will enjoy it.
Also there are whole lot of ready to use boxes
Vagrant boxes
Documentation : [Vagrant Document]

Download and install the php mcrypt extension under windows 10

where can I download and how to install the mcrypt extension for php 7.1 (TS,VC14) under Windows 10 / 64 bit.
I need it for an akeneo project and this has dependencies using mcrypt (and not other extensions).
I haven't found the right extension dll for it.
Thanks for help.
This example is for PHP 7.4 installed by WAMP in Windows 10 (It will work for others versions if you manage to find the php_mcrypt.dll file for PHP version that you need).
Go to: https://windows.php.net/downloads/pecl/releases/mcrypt/1.0.3/php_mcrypt-1.0.3-7.4-ts-vc15-x64.zip
unpack and copy php_mcrypt.dll to C:\wamp64\bin\php\php7.4.0\ext
Include following lines in C:\wamp64\bin\php\php7.4.0\php.ini and C:\wamp64\bin\apache\apache2.4.41\bin\php.ini:
[mcrypt]
extension=php_mcrypt.dll
Restart Apache server
For other PHP versions you may find the php_mcrypt.dll file in https://pecl.php.net/package/mcrypt or in php windows binaries file: in PHP windows binaries files in ext/ folder https://windows.php.net/downloads/releases/
If you need this code run and it uses mcrypt I doubt if it really requires php 7.1
What might help you (however might not be recommended)
Install Wamp for windows link where you can easily switch between PHP 5 and 7
Wamp isn't ideal for custom php versions but I managed to add some "my-versions" if I did not find interesting ones on the list, you can switch versions by click on the icon at the icon try. left or right (check both ways)
check this link also
Much better in customizing your PHP would be Docker but it requires some learning curve instead of clickable Wamp. However with Docker you can do whatever possible to PHP where with Wamp you'll be always having some obstacles (mainly because of lack of resources how to do something, and specific Windows platform).
If you give up with Wamp, install Docker and run command:
docker run --rm -it php:5-apache php -r 'print_r(get_loaded_extensions());'
to check loaded extensions on php 7 with apache run
docker run --rm -it php:7-apache php -r 'print_r(get_loaded_extensions());'
to see if the php version has mcrypt installed and if not then installing it to docker image of php should't be a big deal (let know in comment if you need info bout that)
Here you have an official PHP image for Docker with description how to install extensions Dockerhub PHP image
Maybe this will help mcrypt-module-open
Best solutions is to install Linux. use a VM or the Windows Subsystem for Linux.
https://learn.microsoft.com/en-us/windows/wsl/install-win10

How to install and use PHP on macOS via brew

it seems like a little bit stupid question, but Google for one hour and cannot find it:
How to install php on macOS via brew and use in in shell.
Install is simple (if you have brew already installed):
brew install php
But after installation, when i use php -v i still see default php on mac os and not the brew's one. Shoud I Add brew php binary into PATH, bash profile, or what?
Thank you!
homebrew creates symbolic links in /usr/local/bin to pretty much every binary it installs. So the answer to your question is to add that to your path in your login profile. That will probably be $HOME/.profile and you can add a line like:
export PATH=/usr/local/bin:$PATH
Then it will be set each time you login or open a new Terminal.
So in my case, the trouble was with some access permissions on specific folders on my Mac OS, so just sharing what I learned: if it's not working, carefully examile log / error feed, there can be a hint for you!
On April 1, 2018 Homebrew discontinued the Homebrew/php tap and went with a core install approach, which means many of the extensions now must be installed with PECL. I have written a two part blog series to help with installing Apache and PHP w/ PECL on later versions of MacOS. You can find it at the link below, I hope it helps!
https://medium.com/#crmcmullen/how-to-install-php-on-macos-10-13-high-sierra-and-10-14-mojave-using-homebrew-and-pecl-ef2276db3d62
Step 1: Install Homebrew
The first step is to install Homebrew and this is a tool (package manager for macOS) that will allow us to install easily PHP and basically any other package/tools.
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Step 2: Install PHP
To install PHP we can use the command below. The first command will automatically install the latest version of PHP which is at the current moment of writing this post version 8.
brew install php
If other versions may be preferred we can specify the PHP version and the code will look like the following.
brew install php#7.4
Step 3: The php.ini Config
The default PHP configuration should be sufficient to get started but if there are any other configurations, we can change them through the php.ini located on this path. Do note the PHP version number which in this case is version 8.
/usr/local/etc/php/8.1/php.ini
Step 4: Check if PHP is running
To check if PHP is already running we can make use of the brew services command. First, we can list the services that we have installed.
brew services list
If PHP is not started we can then run the command below to start the service in the background.
brew services start php#8.1
Step 5: Checking PHP Version
Lastly to check the PHP version do run:
php -v
By now you will have PHP running on the background process and every time you logged in to the system it will start by default. Thanks for reading and have a good try.

How to download PHP -thread safe now that Homebrew no longer support --with-thread-safety?

I need to use PHP pthreads on Mac OS High Sierra, but Homebrew is no longer supporting downloads of PHP --with-thread-safety.
How do I get and install a thread safe version of PHP for Mac OS, Php v7.1.16 without homebrew?
If it is going to have to be some sort of manual install - does anyone have step by step directions for the mac or know where I can get instructions?
I have been looking on the internet for instructions for 5 hours now. I'm tired and can't believe that no one has any posted info on this.
I was able to get PHP 7.2.5 installed on Mac OS HighSierra with ZTS/Thread safety by using phpbrew.
Install Steps I took:
Downloaded phpbrew from http://phpbrew.github.io/phpbrew/ and installed with their directions. Please note at the end of the installation, they give you further instructions for setting up your ~/.bashrc to load phpbrew, look for them at the terminal.
Once you have phpbrew running you are ready to install php with zts by using the command below (of course you can install all of the extensions that you like by checking the installation for extension instruction)
phpbrew install php-7.2.5 +openssl='/usr/local/opt/openssl/' -- --enable-maintainer-zts --with-curl=/usr/local/
It is important to have openssl and curl already installed before installing php and you must point to their location on your computer at the install line as I have done above. You can add all the extensions you need, but you must have the openssl and curl because I had a ton of problems with installation without them. But you could try omitting.
For those of you who are using PHP ZTS so that you can go on to install pthreads --ONLY PHP 7.2 and above works with Krakjoes pthread-master which you can download and follow the installation at https://github.com/krakjoe/pthreads

How to install mcrypt on OS X's natively installed PHP?

I am trying to install the mcrypt PHP extension on my OS X Mountain Lion 10.8 operating system. This OS comes shipped with Apache and PHP already installed. The mcrypt extension however does not come shipped with PHP. I want to install mcrypt into the version of PHP that came shipped with my machine.
I do not want to use Homebrew, Macports, or any similar package manager, and I do not want to install another version of PHP in addition to the one I already have. I just want to plug mcrypt into the PHP that came bunded with my OS. I feel like this makes sense, instead of having multiple versions of the same program installed, yet every tutorial I come across seems to all immediately say to use Homebrew/Macports, and the few that don't teach you how to install a new PHP instead of using the one I already have.
I started following the directions laid out on this page: http://www.coolestguyplanettech.com/how-to-install-mcrypt-for-php-on-mac-osx-lion-10-7-development-server/.
I downloaded libmcrypt-2.5.8.tar.gz from Sourceforge.
I extracted the contents with the following command: tar -zxvf libmcrypt-2.5.8.tar.gz.
I entered the libmcrypt-2.5.8 directory that was created and issued the following commands: ./configure, make, and sudo make install.
Now that tutorial says to go into a directory that was created by a new, non-native version of PHP that the tutorial tells you to install, not the native version that came shipped with OS X. The tutorial says to go into the following directory: cd ../php-5.3.13/ext/mcrypt/ (which is a directory I don't have), and run the phpize command. I can't go into that directory because I'm using the native PHP that came with OS X, so instead I go into the libmcrypt-2.5.8 directory, but when I try to run the phpize command I get an error that says: Cannot find config.m4. Make sure that you run '/usr/bin/phpize' in the top level source directory of the module. I do however have the files acinclude.m4 and aclocal.m4 in this directory. I am not sure if they are related to the config.m4 that phpize is looking for.
I am not sure how to proceed. Maybe I should just cut my losses and install another PHP using Macports or Homebrew, but I'd really prefer to use the native PHP that came bundled with OS X. Can you help me figure out how to do this? It would really help me a lot, and help me understand better how PHP and extensions work. Thank you!
"I'd really prefer to use the native PHP that came bundled with OS X.
Can you help me figure out how to do this? It would really help me a
lot, and help me understand better how PHP and extensions work."
The PHP that came bundled with OSX isn't any more "Native" than any other version that you would install.
You don't have that directory because, IIRC, OSX doesn't ship with PHP source, just a compiled binary and apache module.
You can only run phpize on a php extension, which you can get in the PHP source download (including the mcrypt extension). What you downloaded is the C library (which you may also need to install) that the PHP extension will reference (you don't need to worry about how this happens).
If you want to just install that extension:
Download it
Extract and cd into
sudo phpize
sudo ./configure && sudo make && sudo make install
Add extension=mcrypt.so (or whatever is generated) to your php config / php.ini and restart apache
This sounds to me like a good opportunity to learn more about how your computer works. This is some documentation I wrote for myself a few years ago on how to do this:
http://www.calvinfroedge.com/common-php-compile-configuration-options/ (note that the formatting in the blog might not work if you paste it into terminal, for example –with-mysql should be --with-mysql)
Besides, you don't need to get rid of your PHP installation that came with OSX. You can download the PHP source to a brand new directory, compile it, backup the old binary, and either symlink the result of 'which php' to your new installation or add the binaries that get generated after you compile to your source.

Categories