No php.ini after installing php5.1 on debian 7.0 - php

Lately i've been struggling with installing zend optimizer on my machine (since i needed that for irrelevant purposes), but i found out that it works best on php 5.1. So i get one from HERE and zend optimizer i had stored from my backup disk. Both tar.gz files. I installed php, so now php -v returns with:
PHP 5.1.4 (cgi) (built: Jun 10 2013 13:38:28)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
Which indicates that it works quite well. However, to install zend optimizer, i need to edit php.ini file, which is basically nowhere.
I tried looking for it with where is php.ini , got:
php: /usr/lib/php /usr/local/bin/php /usr/local/lib/php
but obviously in none of those i can find any.
then i tried
sudo find / -name "php.ini"
and got nothing.
I'm running Debian 7 Wheezy, with apache2, mysql 5.1 and php5.1 - any ideas?
Linux sklep 3.2.0-4-686-pae #1 SMP Debian 3.2.41-2+deb7u2 i686 GNU/Linux
I'll provide any needed information, to help you help me solve the problem.

Make a PHP script with phpinfo(); in it.
Run it, and it will show you where the .ini file is.

Related

Why is php zip extension not working on ubuntu though it's installed?

I'm on Ubuntu 16.04 and I'm trying to install prestashop e-commerce CMS that requires php zip extension to unzip the main CMS folder.
I have installed php-zip and php7.2-zip and I also restarted the web server (apache2) but the CMS still displays the following message
An error has occured:
You must install PHP zip extension first
Here's the result of my installed php zip packages and my current php version:
eljaouhari#eljaouhari-HP-350-G1:/var/www/html$ php -v
PHP 7.2.5-1+ubuntu16.04.1+deb.sury.org+1 (cli) (built: May 5 2018 04:59:13) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.5-1+ubuntu16.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies
eljaouhari#eljaouhari-HP-350-G1:/var/www/html$ apt list --installed | grep php | grep zip
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
php-zip/xenial,xenial,now 1:7.2+60+ubuntu16.04.1+deb.sury.org+1 all [installé]
php7.2-zip/xenial,now 7.2.5-1+ubuntu16.04.1+deb.sury.org+1 amd64 [installé]
I spent an hour and a half trying to figure out whether I need to activate the extestion on the php.ini file and also installing and reinstalling and restarting the web server but nothing seems to work.
I have tried a few solutions on the web that used to work for me but I can't seem to find a good solution.
Please help me with your experience!
I've found the solution after I printed the results of the phpinfo() function.
It seems that the version of php printed with the "php -v" command is not the version that actually apache is using. Apache ended up using the 7.0 version.
Thanks everyone.

Apache won't load Zend Guard Loader

I'm using Ubuntu 15.04 - 64 Bit with the following setup:
Apache
Server version: Apache/2.4.10 (Ubuntu),
Server built: Jul 24 2015 17:25:18
PHP
PHP 5.6.4-4ubuntu6.2 (cli) (built: Jul 2 2015 15:29:28) Copyright,
(c) 1997-2014 The PHP Group Zend Engine v2.6.0, Copyright (c),
1998-2014 Zend Technologies with Zend OPcache v7.0.4-dev, Copyright,
(c) 1999-2014, by Zend Technologies
My php.ini (The last 5 lines)
; Local Variables:
; tab-width: 4
; End
zend.loader=1
zend_extension="/var/www/extensions/ZendGuardLoader_56.so"
And yeah, ZendGuardLoader won't be loaded (it's not mentioned in "php -v" and also not in "phpinfo()").
Thread safety is disabled! If you need other options, let me know.
What i've tried so far:
removed the "zend.loader=1" option,
Tried "zend_loader.enabled = 1" instead "zend.loader"
included an older version from ZendGuardLoader (5.5 instead 5.6)
Changed the owner and group from both files to my account (instead www-data)
Changed the permissions to 777, 775, 755
Also nice to know:
My Apache Error Log is also "clean". If i rename the .so file, my Apache logs that exception. But on the current setup, the file is readable.. Don't get me wrong, but i expect a message like "ZendGuardLoader can't be loaded because "..
Update1
After a few hours, i'm pretty scared! I've installed vagrant incl. "Debian 7.8" as well, started everything and so on. On my box i've installed PHP (5.4) and Apache, created the www folder to the same destination, and downloaded the 5.4 ZendGuard Loader. In my box setup i did the same, as on my main system like -> php.ini, last entry: "zend_extension=/vagrant/ZendGuardLoader.so"
The file exists, is readable as well, and so on. After creating a new "info.php" ("phpinfo()"), it's still without ZendGuardLoader Extension. The command php -v says mostly same, as main system (differences on version..).
Solution for php -v
Okay guys, my mind was broken - but it's not fixed! I told you, by checking php -v the output is pretty default (no ZendGuardLoader). BUT(!): php -v gets executed by commandline (cli) - so i've added the "zend_extension" inside php5\cli\php.ini -> works like a charm!
PHP 5.4.41-0+deb7u1 (cli) (built: May 22 2015 12:49:18)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies
with Zend Guard Loader v3.3, Copyright (c) 1998-2013, by Zend Technologies
That's what i've wanted. So i've called the phpinfo file by using commandline - and save the output into a separated file. And as i can see, the ZendGuardLoader is given, too!
But there is still the Apache Problem. The zend_extension line matches exactly between apache2\php.ini and cli\php.ini.
So it's not a permission problem, because CLI has no problem. I think, apache is broken, because it won't load that less special extension..
A new day - new ideas
Okay guys, yesterday we got the point, why it won't work on CLI, but that's less the major problem. So i've integrated ioncube on CLI and also on apache. CLI works like a charm. Apache won't load ioncube, too. So what is wrong with this apache..?
I tried to provoke some errors by creating a new file in the php5\apache2\conf.d\ directory. The new file contains the same "zend_extension=/vagrant/ZendGuardLoader.so" snippet, as my php5\apache2\php.ini - so apache2 would try to load the .so twice, and throws the expected error:
PHP Fatal error: [Zend Guard Loader] Extension "Zend Guard Loader" cannot be loaded twice in Unknown on line 0
Apache tries to load both extensions. So i might be right, if i'm gonna say, apache2 load the extension, if it's only one! But it seems, that apache can't work with the extension. Remember - php cli ("php -v" / "php -m" ) can!
For all those people, who wanna to know the solution:
After debugging Apache for a while, i've found, that the include per apache2\php.ini won't work correctly for me. So i've created a new file inside apache2\conf.d\ - and deleted the entry inside apache2\php.ini.
After reloading apache2 nothing changed, but phpinfo() says, the extensions was loaded. I've reloaded again - and, finally!, everything works. I am not sure, what happens to me or apache2.
The curios thing at all: I've to reload apache2 twice after restarting VM. But after that process, everything works perfect. So guys..
TL;DR;
Create new file in apache2\conf.d\ and use same "zend_extension=/path"
Restart apache2 twice.
Profit

Two php version on mac, can i fix it?

I have a configuration problem about my php installation on my mac os x 10.9.2
If i do
php --version
on my terminal i get following output:
PHP 5.3.27 (cli) (built: Dec 4 2013 06:25:36)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2013 Zend Technologies
while if i try to check php version via phpinfo(), i get following
PHP Version 5.4.24
so i have two php different version installed, 5.3.27 for cli mode e 5.4.24 on server side.
Also if i try to change configuration in php.ini, at path that i see on phpinfo() response (/private/etc/php.ini), after restart apache, i don't see nothing change; so i think that php.ini maybe is in another place.
How can i do to fix my php installation to have only one php version?
If you want it 5.4 on the CLI also, try moving the one at /opt/local/bin/php out of $PATH.
Normally php lives at /usr/bin/php, so it should find that one when you move the one at /opt/local/bin/php out of $PATH. Maybe echo $PATH shows /opt/local/bin/ before /usr/bin/ for you?

Mongo driver cannot shown in phpinfo()

# php -m | grep mongo
mongo
# php -v
PHP 5.4.7 (cli) (built: Sep 8 2013 20:19:53)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies
Any idea? Thanks
PHP mongo driver version is 1.2.12
You can follow the steps in the below link
Installing Mongi Driver for PHP
Also Looks like you are having trouble in loading the driver by adding the line
extension=mongo.so
to php configuration
To do that you need to first locate your php.ini files , normally there will be two files one for command line and one for apache .
Off course you can find it in phpinfo() . If you could not find it then
To know the locations of php configuration
Just run below command
php --ini
This command lists all configuration files which are some times not visible in phpinfo()
Hope this helps
NOTE : - I assume that you are using Linux or Unix environment and not windows . I did this guess by looking at the grep command which you have posted in your code :)

How to update the path of PHP to the new version I just installed on mac osx mountain lion?

first I am new to macs, I just installed PHP 5.4.6 on my machine after downloading the PHP package from http://www.php.net, I unzipped it and navigated to the directory through the terminal, then I ran the following commands:
./configure --with-config-file-path=~/php-5.4.6/php.ini
make
make test
sudo make install
I restarted the Apache with sudo apachectl graceful but and when I gone to the info.php it still said PHP 5.3.13 the default version that macs shipped with, I tried to run echo $PATH I got this result /usr/local/php5:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/mysql/bin:/usr/local/mysql/bin when I searched the internet they said something about changing the path because the default PHP is installed on /usr/local/php5 and the new one is installed on /usr/local/bin/, when I run /usr/local/bin/php -v I get
PHP 5.4.6 (cli) (built: Aug 18 2012 22:52:55)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies
So I wanted to know how to update that path.
Thanks in advance and sorry for being long.
You will need to point your httpd.conf configuration to use your new mod_php library... assuming that you passed the proper --with-apxs2 flag during the build.
If using the built-in Apache server, see: /etc/apache2/httpd.conf
LoadModule php5_module <MY_NEW_PATH>/libphp5.so

Categories