Just learning about PHP and MySQL. Attempting to enable PHP on Mac Mini. I've followed several thread regarding this, but have not found a solution.
Terminal Output:
Jessicas-Mac-mini:~ jessicaclark$ php -v
PHP 5.5.14 (cli) (built: Sep 9 2014 19:09:25)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
Jessicas-Mac-mini:~ jessicaclark$ cd /etc/apache2/
Jessicas-Mac-mini:apache2 jessicaclark$ sudo nano httpd.conf
Password:
Jessicas-Mac-mini:apache2 jessicaclark$ sudo apachectl restart
Password:
Jessicas-Mac-mini:apache2 jessicaclark$ httpd -v
Server version: Apache/2.4.9 (Unix)
Server built: Sep 9 2014 14:48:20
Jessicas-Mac-mini:apache2 jessicaclark$ apachectl configtest
AH00526: Syntax error on line 15 of /private/etc/apache2/extra/httpd-dav.conf:
Invalid command 'DavLockDB', perhaps misspelled or defined by a module not included in the server configuration
Supposed to be able to open http://localhost/
with 'It works!'...Any feedback appreciated!
Related
I am following the instructions here to install the Filerun app on my Nginx server, running on Ubuntu / Raspberry Pi 4.
I downloaded the aarch64 version of IonCube and created a file /etc/php/7.4/fpm/conf.d/00-ioncube.ini with contents
zend_extension = /usr/lib/php/ioncube/ioncube_loader_lin_7.4.so
I verified that the referenced so file exists.
I then ran sudo systemctl restart php7.4-fpm and it shows that the service is running.
But when I do php -v I don't see IonCube mentioned:
$ php --version
PHP 7.4.33 (cli) (built: Nov 8 2022 11:40:37) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.33, Copyright (c), by Zend Technologies
And when I visit the actual site I get an error saying:
Site error: the ionCube PHP Loader needs to be installed.
I had the wrong version of IonCube. You can run php -i | head -5 to see the architecture:
phpinfo()
PHP Version => 7.4.33
System => Linux raspberrypi 5.15.76-v7l+ #1597 SMP Fri Nov 4 12:14:58 GMT 2022 armv7l
Build Date => Nov 8 2022 11:40:3
In my case it's armv7l (I was wrong to think it was aarch64).
Downloading the correct version from here solved the problem https://www.ioncube.com/loaders.php
I run these two commands:
curl -1sLf 'https://dl.cloudsmith.io/public/symfony/stable/setup.rpm.sh' | sudo -E bash
sudo dnf install symfony-cli
then when I run the command:
symfony check:requirements
it returns me this:
/usr/local/bin/symfony: line 1: syntax error near unexpected token newline'
/usr/local/bin/symfony: line 1: ``'
my PHP version : PHP 8.1.15 (cli) (built: Jan 31 2023 15:13:17) (NTS gcc x86_64) Copyright (c) The PHP Group Zend Engine v4.1.15, Copyright (c) Zend Technologies
apache version : Server version: Apache/2.4.6 (CentOS) Server built: Mar 24 2022 14:57:57
my goal is to put my Project in production on an OScentos7 server
I just installed a fresh ubuntu system from here (mini.iso)
I choosed no extras at all during the installation process.
These are all the commands which I have executed this far:
(Ignore 4 - 8)
Now I wrote a simple PHP test script (/var/www/html/index.php)
<?php
echo "Hello World";
?>
However, after calling this page from another computer, I literally get the output from the file, instead of the compiled php.
Output:
<?php
echo "Hello World";
?>
I have already restarted apache2, no change.
Apache version:
Server version: Apache/2.4.7 (Ubuntu)
Server built: Jul 15 2016 15:32:47
PHP version:
PHP 7.0.16-4+deb.sury.org~trusty+1 (cli) (built: Mar 2 2017 13:50:00) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
with Zend OPcache v7.0.16-4+deb.sury.org~trusty+1, Copyright (c) 1999-2017, by Zend Technologies
Linux version:
Linux linux 3.13.0-110-generic #157-Ubuntu SMP Mon Feb 20 11:55:25 UTC 2017 i686 i686 i686 GNU/Linux
I already searched the internet, some other user sayed to check if the PHP module is loaded by checking the file httpd.conf, but there is no such file. I searched it by using find / -name "httpd.conf" which gave no results.
You need to install PHP apache2 module to work with PHP. You can install libapache2-mod-php from your terminal by typing the command
sudo apt-get install libapache2-mod-php
After that restart your apache. It will solve your problem.
I am trying for days to enable php on my server. The web server is up, but php is not parsed.
First things first: the server is a CentOS 7 running apache2 and php 7.
Everythign seems to be correctly installed:
OS: uname -a
Linux rafiki 3.10.0-327.10.1.el7.x86_64 #1 SMP Tue Feb 16 17:03:50 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
and :cat /etc/redhat-release
CentOS Linux release 7.2.1511 (Core)
apache: httpd -v
Server version: Apache/2.4.6 (CentOS)
Server built: Jul 18 2016 15:30:14
PHP: php -v
PHP 7.0.10 (cli) (built: Aug 20 2016 07:47:25) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.10, Copyright (c) 1999-2016, by Zend Technologies
Then, in /etc/httpd/conf/httpd.conf there is this line:
Include conf.modules.d/*.conf
And in /etc/httpd/conf.modules.d/:
10-php.conf 00-base.conf 00-dav.conf 00-lua.conf 00-mpm.conf 00-proxy.conf 00-systemd.conf 01-cgi.conf
10-php.conf content:
<IfModule prefork.c>
LoadModule php7_module modules/libphp7.so
</IfModule>
<IfModule !prefork.c>
LoadModule php7_module modules/libphp7-zts.so
</IfModule>
Here is output for ls /etc/httpd/modules/ | grep php
libphp7.so
libphp7-zts.so
In /var/www/, there is a test.php file, which content is:
<?php phpinfo(); ?>
When I try http://[myserver.domain]/test.php, apache serves the raw file, without parsing php code.
I went through a lot of researches including StackOverflow, but none of the results had a solution working for me.
Can someone please help me to get php run properly? Is there something I am doing wrong ?
Solution:
As pointed out by #kyshel, a simple reboot worked.
Try rebooting the server (as others have already suggested). It worked for me.
I'd like to know how can I reinstall PHP via dnf and make it default for apache. My problem is that I have a installed version of PHP but it was compiled and as I'm facing several problems with modules I didn't compile I thought it'd be easier do it this way. I'd like to remove this version that's installed too.
Here it's the result of how it's working on my machine right now:
$ uname -a
Linux dev 4.4.6-200.fc22.x86_64 #1 SMP Wed Mar 16 22:13:40 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
$ httpd -v
Server version: Apache/2.4.18 (Fedora)
Server built: Jan 4 2016 13:05:47
$ php -v
PHP Warning: PHP Startup: Unable to load dynamic library '/opt/php-5.6.19/lib/php/extensions/no-debug-non-zts-20131226/zip.so' - /opt/php-5.6.19/lib/php/extensions/no-debug-non-zts-20131226/zip.so: undefined symbol: executor_globals_id in Unknown on line 0
PHP 5.6.19 (cli) (built: Mar 17 2016 10:26:07)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
I'm just asking because I wasn't able to find how to do that here or several other places I've searched. Tks in advance.