I am running a MacBook Air with macOS Sierra 10.12.3. I upgraded my PHP from 5.x to 7.1.1 according to this site and now I am having two issues:
a) The PHP process startup takes around 7 seconds, even for a php -v to print PHP's version. edit: Solved.
b) Apache does not serve my pages anymore locally. Chrome just shows the generic error page with "ERR_CONNECTION_REFUSED". I have restarted the apache service but don't really know what else to do. The apache vhosts config file worked before and still looks good. edit: Also nothing in the apache error logs.
edit: The syslog shows
(org.apache.httpd[71685]): Service exited due to signal: Segmentation fault: 11 sent by exc handler[0]
(org.apache.httpd): Service only ran for 5 seconds. Pushing respawn out by 5 seconds
Does anyone know how to fix this?
Solved it now.
The issue with Apache was that an additional config file in /etc/apache2/other/+php-osx.conf was created that loaded the php7.1 module, but the module loading of php5 in /etc/apache2/httpd.conf was not disabled.
Loading both obviously crashed apache and commenting out the LoadModule in httpd.conf solved it. I have no idea why the installation routine didn't do that though.
Thank you all for helping me.
https://php-osx.liip.ch is a pretty good site, I used to use it before to upgrade my php installations. I found that time to time it would be untrust worthy and sometimes brick my installation. Edit The scripts used on that site usually compile PHP when ran and this can lead to some interesting quirks and inconsistencies. So I switched to using brew.
Brew is a handy tool for Mac that works a lot like apt-get or yum. I would recommend you try this, it adds libraries in a way that allow you to purge them from your machine and reverting to older versions.
$ brew search php71
# lists all the matches for php71, you will find "homebrew/php/php71"
$ brew install homebrew/php/php71
# installs php71, it will give you some good instructions if there are errors
# typically some permission errors, but it gives commands to run too
$ brew link homebrew/php/php71
# overrides the local php command with "homebrew/php/php71"
$ php -v
PHP 7.1.1 (cli) ...
Then I would suggest looking at PHP Local Server that is built in if its still not working. Although I am 99% sure your issues will be resolved.
In future upgrading your php version is as simple as doing the above again where php71 is your new version (example php72 for 7.2). Removing your old version is easy, although does no harm and does allow you to quickly switch your versions around with a single command line option.
Related
I followed a guide which used home-brew to install the lastest version of php (5.4.8) on OSX Mountain Lion.
I then followed a guide which showed me how to setup and use the pre-installed apache on OSX.
However when I try running up a base Symfony 2 project I get a bunch of errors relating to missing date.timezone in the php.ini.
However I have this correctly setup the php.ini but doing a quick phpinfo() in the Symfony project shows that its using the old preinstalled version of php (5.3) rather than the new one.
In terminal if I type which php & php -v, It shows the correct new version is being used.
But the phpinfo() shows
Did you follow all the instructions provided in the Caveats?
Run brew info php54 to see them again.
Especially the line:
To enable PHP in Apache add the following to httpd.conf and restart Apache:
LoadModule php5_module /usr/local/Cellar/php54/5.4.8/libexec/apache2/libphp5.so
Apache is not aware of the homebrew version of PHP (i.e. /usr/bin/php). You see it on the command line because you've likely modified your PATH (i.e. /usr/local/bin/php).
You can modify this in your httpd.conf file.
I am not a fan of homebrew or other package libraries. Primarily because Mac OS X is built atop Unix. Furthermore, all but MySQL are installed natively. Here's an article on installing Apache, MySQL, and PHP on Mac OS X.
Disclaimer: I wrote that article.
Today I have same issue for updating php 7.2 to 7.3 as requirement of Laravel 6. Here is my solution.
Open your httpd.conf file in "/etc/apache2/http.conf"
Search (Ctrl + w) for "LoadModule php"
Uncomment that row
Restart your apache with "sudo apachectl restart"
Then, your php version in local web server (apache2) will be updated
I carefully read all Q&A here for about 2 days but could not resolve my issue, so please do not say that i should read something in first 20 strings of search.
My problem is:
I use Xubuntu, apache2 and php5. Cassandra itself installed and working, cassandra service is running, cassandra cpp installed.
Command
pecl install cassandra
works ok, physically cassandra.so exist. When i add extension=cassandra.so in php.ini Apache crashes on start.
When i try run
php -r " Cassandra::cluster()->build();"<br>
it returns:
PHP Fatal error: Class 'Cassandra' not found in Command line code on line 1
I try add extension that not exist in 'php.ini'(like extension = sdbcibsdbc.so) but it simply ignored, so problem is not in mistakes or something - cassandra.so makes crash. Also previous version(cassandra-1.0.0) simply ignored, not crash Apache but not work too.
What can it be?
I resolve issue, but details still unclear.
This situation, when you can install cassandra php driver but cant add into 'php.ini' means that some of C++ driver dependences not resolved, in my case it was libuv. Have no idea how it possible: libuv-dev without libuv and why pecl throw no errrors.
I remove libuv 1.8.0 and install 1.7.5 - and all OK! Then i try 1.8.0 again and it works too. So, probably i miss some step in installation process but it goes without errors or warnings.
As always, most problems will disappear with carefully reinstall.
After installing Cassandra you must add extension=cassandra.so to php.ini to enable it:
Build process completed successfully
Installing '/opt/rh/rh-php71/root/usr/lib64/php/modules/cassandra.so'
install ok: channel://pecl.php.net/cassandra-1.3.2
configuration option "php_ini" is not set to php.ini location
You should add "extension=cassandra.so" to php.ini
I am having some trouble using BREW on my local host server. I installed brew via Terminal on my Mac and installed FREETDS using brew. I have also changed my default PHP to the MAMP PHP.
Running which php gives:
which php
/Applications/MAMP/bin/php/php7.0.0/bin/php
But it seems the packages I install via brew don't take effect on the MAMP PHP SERVER. I cant see the FREETDS driver anywhere in PHPINFO. Any help guys?
Maybe you can try from terminal to run
php --ini
Output will show you loaded ini file for PHP client. Than you can try to edit that ini file and include additional PHP extension if they are installed.
If possible i would suggest to don't use MAMP, but some Vagrant environment.
If you type:
brew info php
You'll see that Homebrew is installing to a separate directory than MAMP (including extensions). You'll need to reconcile the two somehow to get it working correctly, but it may be worth it to configure your machine to serve from Homebrew's version instead of relying on MAMP Pro - otherwise you'll be moving files around.
The problem here lies with me using MAMP. MAMP is not compatible with brew nor does it let me install extensions. The way I got around this was completely ditch MAMP and just go with PHPBREW which is a much more flexible solution and VERY EASY to setup. If you are going to need anything remotely custom (extensions etc.) go for PHPBREW.... it will save you so much time.
I've been trying to install Composer for about a month now on a Windows 10 computer. Every time I run the Windows OS installer, it gives me this error:
Some settings on your machine make Composer unable to work properly.
Make sure that you fix the issues listed below and run this script again:
The openssl extension is missing, which means that secure HTTPS transfers are impossible.
If possible you should enable it or recompile php with --with-openssl
I've checked in my php.ini file (C:\Bitnami\wampstack-5.4.39-0\php\php.ini) and it is not commented out. I've checked for the DLL itself in the ETC folder, it's there. I've restarted my Apache Web Server several times. Heck, I've reinstalled PHP and my WAMP Servers. Nothing is working. I've tried downloading a fresh Composer installer thinking maybe my original one got corrupted some how. Still doesn't work. Am I missing something here?
After about another week of research and talking with a University professor about it, I ultimately found that the issue stemmed from my Bitnami installation path. Installing the wampstack as it defaulted by the installer (wampstack-version#) seems to cause problems in composers ability to install. Make sure to install it without the version on the end of the wampstack path.
I have OS X 10.5 set up with the precompiled versions of PHP 5 and Apache 2. I'm trying to set up the Zend Debugger, but with no luck. Here's what I did:
I downloaded ZendDebugger-5.2.14-darwin8.6-uni.tar
I created the directory /Developer/Extras/PHP and set the permissions to:
Permissions: drwxrwxr-x
Owner: root:admin
I copied ZendDebugger.so from the 5_2_x_comp directory to /Developer/Extras/PHP
I updated /etc/php.ini file, adding the following lines:
zend_extension=/Developer/Extras/PHP/ZendDebugger.so
zend_debugger.expose_remotely=always
zend_debugger.connector_port=10013
zend_debugger.allow_hosts=127.0.0.1
I restarted Apache via the System Preferences "Sharing" panel
When I run phpinfo() within a PHP file, I get no mention of the Zend Debugger. When I run php -m from the command line, it shows the Zend Debugger is loaded. Both state that they're running the same version of PHP, and loading the same INI file.
Anyone have another suggestion for me to try?
If I remember correctly, this problem is do to the fact that the Zend Debugger is compiled for 32-bit Apache while the Apache that comes with Max OS 10.5 is compiled as 64-bit application. Until Zend comes out with a 64-bit version, you have two options:
1) Restart Apache manually into 32-bit
2) Recompile Apache and PHP in 32-bit mode.
I haven't actually gotten around to doing either yet, but I think I am leaning to recompiling to avoid future problems.
Restarting in 32-bit mode did the trick. For those of you who want to be able to do this easily, here's a little bit of AppleScript:
do shell script "apachectl stop" with administrator privileges
do shell script "arch -i386 /usr/sbin/httpd" with administrator privileges
It's nice to have sitting somewhere so you can quickly pop into 32-bit mode when needed.
Zend released the 64bit version for Mac OSX, so just download the file from http://www.zend.com/en/products/studio/downloads and procede as normal.
You will have to register and answer some questions, but it worked for me.
Good Luck.
Me too, HOURS!! Thanks so much!!
Also if for some reason you need to restart apache/httpd after running this (e.g. you need to make a change in your php.ini) but when you run "sudo arch -i386 /usr/sbin/httpd" you're getting this error:
(48)Address already in use: make_sock: could not bind to address [::]:80
type this in a terminal window:
sudo killall httpd
then "sudo arch -i386 /usr/sbin/httpd" should work fine to restart apache/httpd.