My previous php version is 7.3 and it was default in mac os. After installing new PHP version 7.4 with homebrew I update the php path.
When I run php --version it shows me php v7.4.23 but when I run any php code it doesn't work. I think I need to do some configuration in my settings. I follow some tutorial but nothing resolve my issue
Whenever I run any php it gives me this error
Fatal error: require(): Failed opening required '/Users/Raymond Tucker/projects/test/vue-test/foridpur_ict/vendor/autoload.php' (include_path='.:/usr/local/Cellar/php#7.4/7.4.22/share/php#7.4/pear') in /Users/Raymond Tucker/projects/test/vue-test/foridpur_ict/artisan on line 18
This is my output of $ where php
➜ ~ where php
/usr/local/opt/php#7.4/bin/php
/usr/local/opt/php#7.4/bin/php
/usr/local/bin/php
/usr/bin/php
➜ ~
To use the new PHP version you have to edit the Apache file:
Open the httpd.conf file and find the LoadModule. it should have the correct version of the PHP. It will look something like this:-
LoadModule php7_module /usr/local/opt/php#7.3/lib/httpd/modules/libphp7.so
What you have to do is, change this to point to the correct version of the php.
LoadModule php7_module /usr/local/opt/php#7.4/lib/httpd/modules/libphp7.so
I have Mac El Capitan. Nothing worked for me except this article (super fast).
It allowed me to update php5 to php7, I don't know why, and honestly I don't feel it was real, but I don't understand how has the php5 became php7.
Back in the day, I did it with Macports, but I couldn't install Macports this time, so I had to use this new method.
Although not a direct answer to your question Mamp pro enables you to switch PHP versions easily. It made my development life much easier.
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 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.
Just got on a Windows 10 and after I configured my php.ini and http.conf I went on the command line httpd.exe and got this error message:
httpd.exe: Syntax error on line 530 of C:/Apache/conf/httpd.conf: Cannot load C:/php/php7apache2_4.dll into server: The specified module could not be found.
I KNOW this file is in that folder. I've installed both 64 bits version of PHP and Apache and I don't know what's going on.
Check whether you have installed Thread safe version of PHP. Non Thread safe version will cause this error.
You can download thread safe version of PHP here
while you downloading PHP u should select ThreadSafe pack, Apache not supporting nonThreadSafe...
As the others said, the NON Thread safe (nts) does not support apache and u have to install thread safe versions
Which VC compiled version of Apache do you use?
On php.net they recommend to use the apache server from apachelounge.com combined with the threadsafe php files.
Also make sure that you have installed the C++ Redistributable Visual Studio 2015.
If it still fails with that error make sure the user who is starting the process has access to the filesystem.
I was able to overcome this error by uninstalling my previous version of wampserver , then installing the latest version (3.2.0), closer to the php7.4.9 target.
As I previous had php 7.2 with an earlier version of wampserver (can't remember which), none of the above tricks would work for me. I was still getting the error of this topic title. Now working ok.
Reminder: to integrate an external version of php into wamp, rename php.ini-development in folder php7.4.9 into phpForApache.ini
I'm not sure if this is the same problem, but I had an issue that the Apache httpd service would not start when I tried to add the php module to an apache server (httpd.conf). The service would not start. When I looked at the Event Viewer I found an application error event indicating that the service terminate unexpectedly, and it indicated that the problem occurred in Apache24\bin\libapr-1.dll.
The problem was with the LoadModule statement that I added at the end of my httpd.conf file. Here's what I orginally had:
LoadModule php7_module "C:\PHP7\php7apache2_4.dll"
Here's what I changed it to:
LoadModule php7_module C:\PHP7\php7apache2_4.dll
Low and behold, the apache service started, any I was able to execute the phpinfo.php sample script that I added to the Root Document directory. (By the way, forward or backward slashes both work.)
The difference is that I removed the quotes. The quotes were there because I had just copied and pasted from a web page that said how to install PHP.
I had a similar issue and when i looked in the apache24 error log it said something about PHP Warning: 'vcruntime140.dll' 14.0 is not compatible with this PHP build linked with 14.16 in Unknown etc. I had installed a version of vcredist but obviously it needed a more upto date version and found solution here: vcruntime140.dll 14.0 not compatible with PHP build
In terminal,
php -v
gives
PHP 5.3.29 (cli) (built: Sep 28 2015 06:33:13)
(with imagick installed) but, in the browser (using apache)
phpinfo();
gives
PHP Version 5.5.27
(with no imagick installed) How do I resolve this?
I don't want to mess about with php.ini and httpd.conf when I'm not entirely sure what I'm doing!
Solved it. I entered
locate libphp5.so
into terminal to find paths to the php installations. This outputted
/usr/libexec/apache2/libphp5.so
/usr/local/Cellar/php53/5.3.29_4/libexec/apache2/libphp5.so
I then edited the apache configuration file
sudo nano /private/etc/apache2/httpd.conf
and changed
LoadModule php5_module libexec/apache2/libphp5.so
to
LoadModule php5_module /usr/local/Cellar/php53/5.3.29_4/libexec/apache2/libphp5.so
NOTE : This line will be different for your local installation, copy the value outputted from the locate command above
I then restarted apache with:
sudo apachectl graceful
Credit to this solution for the command to find the php installations
This may be a help to you : Upgrade to PHP 5.4 on MAC and remove version 5.3.10
I would suggest that you work in a virtual setup instead.
like Vagrant: https://www.vagrantup.com/
Also take a look at Homestead: http://laravel.com/docs/4.2/homestead
"Laravel Homestead is an official, pre-packaged Vagrant "box" that provides you a wonderful development environment without requiring you to install PHP, HHVM, a web server, and any other server software on your local machine.
"
It will also allow you to keep your configuration if you change machine and/or operating system.
I'm trying to install orocrm on centos server and it is asking for PHP 5.4 and ICU library 4.4. Although I updated PHP and restarted Apache my php version still shows PHP 5.3 if outputting phpinfo in a php page. But,if I use php -v command then it shows php 5.5
ini path is shown /usr/local/lib/php.ini if using php page but through command it shows /etc/php.ini
please help...
The PHP 5.4 you compiled is not getting picked up by Apache. Rather than figuring out how to point Apache to this installation, the easiest (and safer since you'll get security updates) is to use the IUS Community repository
I have a couple of thoughts. If you're on CentOS you're probably using YUM as your package manager. With it, you could remove the PHP's and add a new one (if you don't have active clients using it). You can search what PHP version yum has by doing one of these:
yum list
yum list installed
If it registers multiple versions, you can "yum remove $package".
If you're php -v showing version 5.5, then your path is set to include that. You can see that by typing $PATH from the command line when SSH'd in. In your ~/.bashrc (or ~/.profile) you can edit your $PATH by adding something like:
export PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin
EDIT: You should back up your PATH before writing a new one and after you edit it type "source ~/.bashrc" or "source ~/.profile" to make the command line see it.
You can also directly edit the php in the .bashrc to point to the correct version by setting up an alias (if you don't fix the root of the problem) like
alias php="/path/to/php"
You can see where your current php is by typing:
which php
Your PHP extension comes from the apache httpd.conf file. You can find it somewhere like /etc/apache2/httpd.conf. Search for "LoadModule" or "LoadModule php" and see which extension of PHP your apache is pointing to. It may still be pointing to an incorrect version.
To answer your question about ICU, it comes from the "intl" extension. With yum, this is probably called php-intl or php54-intl or php54w-intl. You can do something like "yum search intl" and it should give you the exact extension name.
I hope this helps!