Apache won't load Zend Guard Loader - php

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

Related

Configure CLI interpreter for PhpStorm on Mac

I have installed PHP from brew and it works just fine in VSCode, but in PhpStorm I am not able to configure the interpreter in order to debug my PHP code.
In the configuration file, it says "PHP not installed" with a red icon, and the executable path is empty.
I am trying to debug just code, not a web page, so there is no need of Apache Server or other for now.
When executing php -v on terminal, I get:
PHP 8.0.17 (cli) (built: Apr 5 2022 22:43:04) ( NTS ) Copyright (c)
The PHP Group Zend Engine v4.0.17, Copyright (c) Zend Technologies
with Zend OPcache v8.0.17, Copyright (c), by Zend Technologies
which tells me that this installed correctly.
As per PhpStorm documentation you have to point to PHP executable there (which means: provide the full path). Just having php may not be enough.
Open your OS terminal and type which php (or it could be where php; this depends on the OS used). It will show the full path to the executable that gets executed when you run php in that terminal.
If you have more than one PHP version installed and want to use non-default PHP installation/version then use the path for that specific version.
Copy that full path from there (if there are more than one path then use the top most or the most desired one) and use it in the "PHP executable" field of the PHP Interpreters screen in PhpStorm.

error upgrading php in mac

I am running OSX El Capitan (version 10.11.6).
I had php 5.5 installed.
Phpunit requires php5.6 and more so I tried to upgrade my php to 5.6. I couldn't do it so I gave php7 a try.
I followed these guides:
https://coolestguidesontheplanet.com/upgrade-php-on-osx/
https://php-osx.liip.ch/
Mac upgraded PHP to 5.6, but CLI php -v get 5.3.28?
My current output with php -v is :
PHP 7.0.12 (cli) (built: Nov 1 2016 10:21:11) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.12, Copyright (c) 1999-2016, by Zend Technologies
with Xdebug v2.4.1, Copyright (c) 2002-2016, by Derick Rethans
Funny thing, my output with a phpinfo(); when called from somewhere inside a Symfony project, is still PHP Version 5.5.36
Any ideas??
Terminal uses a different PHP than a HTTP server in browser. You can check what PHP you're using in CLI (command line interface) by this terminal command:
$ which php
I don't know if you use any AMP stack (like MAMP). They include their own PHP, so you need to update them in order to have a different PHP version in browser.
Maybe you can use this trick to determine what PHP versions you use in browser / CLI: Find the php.ini path in your phpinfo() output and compare it with this terminal command:
$ php -i | grep php.ini
It's always a good idea to use the debug URL to troubleshoot your Symfony projects; to use this, simply append:
app_dev.php
For example if your route was like http://myhome/, then you would use:
http://myhome/app_dev.php
Then on the bottom of your browser you will have the Symfony debug bar. In the bottom right corner, the version of Symofny is shown, an if you move your mouse over it, you will see the version of PHP; plus also a link to "View phpinfo()". You can click on it to view the full PHP information, including where the PHP file is located.
The PHP config file used (shown on the phpinfo() page) is shown by:
Loaded Configuration File
Hope that helps!

Cannot run php from command line when use environment variable

I have windows 8, and whenever I run php from the installed directory, then it works without a problem, but whenever I set the environment variable to that directory, and run php --version, then a win-8 bar appears:
This app can't run on your PC To find a version for your PC,
check with the software publisher
Has anyone encountered a similar issue or found a solution for this?
Attached below are the commands that i ran:
K:\Users\username>php
Access is denied.
K:\Users\username>php
Access is denied.
K:\Users\username>php --version
Access is denied.
K:\Users\username>F:/
'F:/' is not recognized as an internal or external command,
operable program or batch file.
K:\Users\username>F:
F:\>php
Access is denied.
F:\>cd Program
F:\Program>cd php-5.5.6-x86
F:\Program\php-5.5.6-x86>ls
dev iculx51.dll libpq.dll php.gif
ext icutest51.dll libsasl.dll php.ini-development
extras icutu51.dll license.txt php.ini-production
glib-2.dll icuuc51.dll news.txt php5.dll
gmodule-2.dll install.txt phar.phar.bat readme-redist-bins.txt
icudt51.dll libeay32.dll pharcommand.phar snapshot.txt
icuin51.dll libenchant.dll php-cgi.exe ssleay32.dll
icuio51.dll libenchant_ispell.dll php-win.exe
icule51.dll libenchant_myspell.dll php.exe
F:\Program\php-5.5.6-x86>php --version
PHP 5.5.6 (cli) (built: Nov 12 2013 11:33:16)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2013 Zend Technologies
F:\Program\php-5.5.6-x86>
By the way the same thing occurs in wampserver php, so it probably dont have anything to do with 86 bit install or 5.5.6 unstable.
I also tried run as admin not working either, same output.
You might have two PHP executables, one of them (F:\Program\php-5.5.6-x86\php.exe) is working, one of them (which is on your path) is not. Check the directories in your PATH for the broken one.
I have same issue before and tried several things, one of the things that works for me that the php.exe file has been changed by some program and it's size was 0 kb, I reverted back by bringing the php.exe file from backup folder I have.
may be it is not solution for all people, but just check the php file hasn't been changed.

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

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.

Error in httpd.conf. Can't locate API module structure `php5_module'

I've recently installed phc, the php compiler. I started out installing LAMP from source with --enable-so for Apache and --enable-embed for PHP5 (among other options these are most relevant to the installation and later configuration).
When I finished installing I realized phc does not yet support PHP5.3 so I uninstalled it and installed PHP5.2. phc works fine now, as does the PHP client application for the commandline. Apache seems to be running fine, too, when I comment out line 193 (see below). It just doesn't parse PHP.
httpd: Syntax error on line 193 of /etc/apache2/conf/httpd.conf: Can't locate API module structure `php5_module' in file /usr/local/lib/libphp5.so: /usr/local/lib/libphp5.so: undefined symbol: php5_module
When I check my version of PHP from the terminal I get the expected output (5.2):
[root#localhost conf]# php -v
PHP 5.2.14 (cli) (built: Sep 7 2010 22:50:25)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2010 Zend Technologies
I made sure to move the libphp5.so file from the folder where I built php5.2 (/usr/local/src/php-5.2.14) to /usr/local/lib. I also moved php.ini to /usr/local/lib.
Is there something I'm missing here?
OK!
Apparently when you configure PHP it's important to include the line specifying wehre to find apxs for the proper installation:
--with-apxs2=/etc/apache2/bin/apxs
I did this and the problem vanished :)

Categories