Module 'eAccelerator' already loaded php warning - php

I'm getting this PHP warning in my error_log and want to get it fixed. I'm told it is loaded within php.ini which I've verified as well as a bunch of configuration settings for the module. I'd like to maintain the module configuration in the place where it's loaded so I need to find out how else to remove it from the list.
Unless removing it from php.ini is just fine.
Module 'eAccelerator' already loaded

It sounds to me like you've got the configuration in multiple files.
If your set up is on Debian (or something like Debian) it could be that eAccelerator is loaded in php.ini as well as in a secondary file. For instance, on Debian, php.ini lives at /etc/php5/apache2/php.ini (for PHP 5.x and Apache 2.x). But it also parses all the files in /etc/php5/conf.d/, which in my case includes files like gd.ini, mysql.ini, and suhosin.ini. I have see misconfigured packages add configuration to the end of php.ini as well as in a separate file in conf.d. This will give the kind of error you're seeing.
FYI, this scanning is done with a compile-time configure option (specifically, --with-config-file-scan-dir=).

Related

How to fix PHP Deprecated Automatically populating $HTTP_RAW_POST_DATA is deprecated issue?

hello i'm getting this error in my error log:
"PHP Deprecated: Automatically populating $HTTP_RAW_POST_DATA is deprecated and will be removed in a future version. To avoid this warning set 'always_populate_raw_post_data' to '-1' in php.ini and use the php://input stream instead. in Unknown on line 0"
My wordpress version is 4.8.1 and the php version is 5.6.30.
I tried fixing the issue by creating a php ini file and setting always_populate_raw_post_data value to -1. But i still get the error.
If it cannot be fixed, how can i prevent it prints on the error log?
I'm using a shared hosting.
how can i prevent it prints on the error log?
Your problem here is not that you cannot access php.ini and it is not that error shows.
Your problem, in fact, is that you use deprecated variable
instead, you could try using
file_get_contents('php://input');
php.ini is located somewhere in the php files on the server, which I assume you have no access to on shared hosting.
The php.ini file you created needs to be located where PHP expects to find its config files. You can see the configs which PHP is already loading using the phpinfo() function:
Upload a file named info.php with the following contents to your web server root:
<?php
// delete this file or comment out the below function when not in use
phpinfo();
?>
Then use a browser to navigate to http://yourwebsite.com/info.php. A page should load which tells you all about your php configuration. Look for the part near the top which shows information about the loaded configuration files. In particular, look for these entries:
"Loaded Configuration File" and "Scan this dir for additional .ini files".
If you have access to the .ini file listed as the Loaded Configuration File simply modify the value for always_populate_raw_post_data there. Otherwise, upload the .ini file you already created to the directory that is scanned for additional configuration files. Of course, you'll need to reload or restart php in order to reparse the configuration files.
If you don't have access to any of the locations listed from the above steps, it's possible your hosting provider may give you access to your php.ini file through cPanel or a similar means. Otherwise, your best bet is to contact them directly.
Finally, if you don't care about the actual configuration value as much as just suppressing the warning message, you could use the ini_set() function to set your error reporting to a different value, eliminating any deprecation warnings. The variable you want to set is "error_reporting" and a list of possible values can be found here.
In addition, since you are running WordPress there are some debug and error reporting options you can set in the wp-config.php file.
If your Account (on the shared hosting) using (or Configured) PHP-FPM, you can't do it via php.ini (if you create php.ini in your root, it will have no effect)
you can try: add this code
<IfModule mod_php5.c>
php_value always_populate_raw_post_data -1
</IfModule>
in your .htaccess file in your root directory, if not helps then ask the server admin (support) to change that in core php.ini globally for the given host.
You cant create a PHP.ini just like that. This is a core config file that is part of the PHP install. http://php.net/manual/en/configuration.file.php Read over this documentation to get a better idea of what the ini does.
The ini file could be located in multiple places depending on the OS and who installed it. If you do not have access to it, talk to your hosting provider

Installing PHP on Linux and php.ini file

I have installed PHP with Apache 2.2 on my Linux machine and all works fine following guide here
During the installation I had to copy the php.ini-development file into /usr/local/lib/php.ini, the question is why? Why exactly in this directory?
Default locations of the PHP configurations vary greatly by distribution. In any case, phpinfo() will allways tell you where is looks for your configurations.
So, create file with extension ".php" in your webroot and past this into it:
<?php
phpinfo();
Also, the default php.ini files contain plenty od usefull comments. Just read them and change what you need. Differences between dev and prod environments are usually only the verbosity. They show and log different ammounts of errors. Production usually shows no error at all.
(Debian and many other distributions put the PHP config into /etc/php5. This is actually the most reasonable place for configurations, but stick with what your distribution uses.)
The document you link to says this
You may edit your .ini file to set PHP options. [...]
If you instead choose php.ini-production, be certain to read the list of changes within, as they affect how PHP behaves.`
Have you tried something like
vi /usr/local/lib/php.ini
to see what's in it?
Maybe you need to read http://www.php.net/manual/en/configuration.file.php
You copied a default PHP.ini file, php.ini-development, to the standard 'php.ini' file in the location '/usr/local/lib/' the guide http://www.php.net/manual/it/install.unix.apache2.php
expected the php.ini file to be.
The php.ini file is a configuration file used by PHP when it is launched (runtime)

Extensions shown in phpinfo() don't match with those enabled in loaded php.ini

I use EnterpriseDB ApachePHP on Windows XP (32 bit). I tried to enable some extensions in php.ini in the directory with ApachePHP, but nothing changed. Then I found that phpinfo() not just doesn't show the extensions I uncommented in php.ini, but it also shows others that I didn't uncomment. I have several other php.ini files on my computer, but phpinfo() shows the correct path to the php.ini file as "Loaded Configuration File" (D:\Programy\EDB_Apache\php\php.ini - that the path to the php.ini file I use; plus it shows its copy in C:\WINDOWS in "Configuration File (php.ini) Path").
The configuration must be overriden by something in ApachePHP - pgsql and pdo_pgsql are among the commented but shown libraries, while all my other php.ini instances have only MySQL and SQLite enabled. On the other hand, even the extensions contained in D:\Programy\EDB_Apache\php\Sdk\include\ext (D:\Programy\EDB_Apache is ApachePHP root) don't match those shown in phpinfo(), so it might be even more difficult.
So how to find and edit the configuration that is shown in my phpinfo(), or how to solve the bug causing it not to correspond to the loaded php.ini file? Please don't tell me to restart Apache or my computer (I configure localhost), I did this many times, even just before asking this question.
EDIT: Once again, I'm absolutely sure the path shown in phpinfo() as "Loaded Configuration File" matches to the path of the php.ini file I use. Even if the path shown there was not correct (which would be a matter of a question - how is it possible, and how to correct it?), no one of php.ini files on my computer matches the configuration shown by phpinfo. I have searched for any instance of php.ini, so I'm sure I didn't miss any of them, even if it was a hidden/system file.
EDIT2: reinstall of EDB ApachePHP didn't help. I changed the paths slightly during the reinstall, so I updated paths here. "Loaded Configuration File" path still matches the right configuration file, and I keep restarting Apache after every change.
I looked closer to phpinfo(), especially to "Configure Command":
cscript /nologo configure.js "--enable-cli" "--enable-cgi"
"--with-openssl" "--enable-pdo"
"--with-extra-includes=C:\pgBuild32\include;D:\pginstaller_2.auto-repo\output\include;D:\pginstaller_2.auto-repo\apache.staging\include"
"--with-extra-libs=C:\pgBuild32\lib;D:\pginstaller_2.auto-repo\output\lib;D:\pginstaller_2.auto-repo\apache.staging\lib" "--enable-apache2filter" "--enable-apache2-2filter"
"--enable-apache2handler" "--enable-apache2-4handler"
"--with-apache-hooks" "--with-pgsql" "--with-pdo-pgsql"
"--with-prefix=D:\pginstaller_2.auto-repo\php.staging"
"--enable-one-shot" "--enable-cli-win32" "--enable-embed"
"--enable-isapi" "--enable-ftp" "--without-mysqlnd"
"--with-xsl=SHARED" "--enable-mbstring" "--enable-mbregex"
"--enable-shmop" "--enable-exif" "--enable-soap" "--enable-sockets"
"--with-gd=SHARED" "--without-mysql" "--without-mysqli"
"--without-sqlite3" "--without-pdo-mysql" "--without-pdo-sqlite"
Paths listed there (C:\\pgBuild32\include, D:\\pginstaller_2.auto-repo\output\lib etc.) don't exist on my computer. Their existence seems to confirm my assumption that parts of the setting are overwritten by some EnterpriseDB default (or that configuration in php.ini somehow doesn't work, so the defaults are applied). I don't know where are these settings saved - that's the point of this question, if I knew, I would change them and celebrate.
There is another possible cause of the problem: lack of dll's. Most php distributions have them in ./ext. In EnterpriseDB "php" directory has only one subdirectory, and it is named "Sdk"; the extensions are (or should be; there are no dll files in that dir) in D:\Programy\EDB_Apache\php\Sdk\include\ext directory. This directory contains only .h files (in directories named after the extensions), no dll. If this is not the ordinary architecture for EnterpriseDB bundle, please tell me; I might have a bad installer file.
So I first copied the dll's from another php installation (I didn't manage to get exactly those for PHP 5.4.23, but they are 5.4 too) into the extension folder, but nothing changed. Then I even copied whole ext folder to php directory in the ApachePHP bundle location and changed the extension path to it - again, no change.
For testing reasons, I tried to run php.exe. It returned a warning:
PHP Warning: PHP Startup: gd: Unable to initialize module
Module compiled with build ID=API2010025,TS,VC9
PHP compiled with build ID=API2010025,TS,VC10
These options need to match
in Unknown on line 0
So if I want to substitute dll's, I need to find either VC9 ApachePHP (will it still support PostgreSQL 9.3? My main reason for all this is to be able to created forms for my database), or VC10 PHP 5.4. I didn't find any .msi installer for PHP 5.4 (even less VC10 one) and after some bad experiences with software installation through command line on Windows I don't want to try non-msi version without being sure that this is the only choice.
Any advice now?

How to configure htaccess-like files for configuring PHP when on shared hosting situations or FCGI? [duplicate]

My development environment is shared with other developers of my startup and is setup on Rackspace. The php.ini file is located in /etc/ folder, and I believe this is a centralized location from where every other developer's dev environment setting is being configured from. I want to customize this php.ini file specifically for myself rather than having to do it in the /etc/ location.
Specifically I am setting up XDEBUG in my environment, some other developers don't want it, so I don't want to bug em :)
To do so, I scanned the Internet on how to override the php.ini file specifically for a directory, and found this page on stackoverflow
And following that, I simply copy pasted the php.ini file within my htdocs folder and then simply echoed out phpinfo() (I echoed this in one of my Controllers, (using Zend)). The index.php file is within the htdocs folder.
When I look # "Loaded Configuration File", it still reads
/etc/ instead of ../htdocs/
Anybody know what's up?
In general, it isn't possible to load php.ini on a per directory basis, but in some special cases (CGI/FastCGI), it is: see documentation for Per-user configuration
Since PHP 5.3.0, PHP includes support for .htaccess-style INI files on a per-directory basis. These files are processed only by the CGI/FastCGI SAPI. This functionality obsoletes the PECL htscanner extension. If you are using Apache, use .htaccess files for the same effect.
In addition to the main php.ini file, PHP scans for INI files in each directory, starting with the directory of the requested PHP file, and working its way up to the current document root (as set in $_SERVER['DOCUMENT_ROOT']). In case the PHP file is outside the document root, only its directory is scanned.
If you are hosting several independent sites on one server, you should consider FastCGI anyway, to keep them separated. With php5-fpm it's very easy to setup many pools of workers.
Note that only set a limited subset of the ini-options in the user-ini-file.
As you said you don't have control on the server, the possible work-arounds would be to:
Use ini_set() to override the changes inside your script. Not all of the configuration directives can be changed using ini_set() though.
Use an .htaccess file in your directory to override the configurations in php.ini file.
(certain parts adapted from #1438393)
Hope this helps!
I'm not sure you understood the post. The post means if you run the server and want a per domain php.ini you can run the module as a per domain so each user controls there domain php.ini however it looks like your server does not offer this so you will need to us htaccess file to overwrite the php.ini settings.
By over write this doesn't mean you can change the directory this means maybe add a module or add error reporting ect...
You can do it by using this post: How can I use xdebug to debug only one virtual host?

Overriding PHP.ini in a shared development environment

My development environment is shared with other developers of my startup and is setup on Rackspace. The php.ini file is located in /etc/ folder, and I believe this is a centralized location from where every other developer's dev environment setting is being configured from. I want to customize this php.ini file specifically for myself rather than having to do it in the /etc/ location.
Specifically I am setting up XDEBUG in my environment, some other developers don't want it, so I don't want to bug em :)
To do so, I scanned the Internet on how to override the php.ini file specifically for a directory, and found this page on stackoverflow
And following that, I simply copy pasted the php.ini file within my htdocs folder and then simply echoed out phpinfo() (I echoed this in one of my Controllers, (using Zend)). The index.php file is within the htdocs folder.
When I look # "Loaded Configuration File", it still reads
/etc/ instead of ../htdocs/
Anybody know what's up?
In general, it isn't possible to load php.ini on a per directory basis, but in some special cases (CGI/FastCGI), it is: see documentation for Per-user configuration
Since PHP 5.3.0, PHP includes support for .htaccess-style INI files on a per-directory basis. These files are processed only by the CGI/FastCGI SAPI. This functionality obsoletes the PECL htscanner extension. If you are using Apache, use .htaccess files for the same effect.
In addition to the main php.ini file, PHP scans for INI files in each directory, starting with the directory of the requested PHP file, and working its way up to the current document root (as set in $_SERVER['DOCUMENT_ROOT']). In case the PHP file is outside the document root, only its directory is scanned.
If you are hosting several independent sites on one server, you should consider FastCGI anyway, to keep them separated. With php5-fpm it's very easy to setup many pools of workers.
Note that only set a limited subset of the ini-options in the user-ini-file.
As you said you don't have control on the server, the possible work-arounds would be to:
Use ini_set() to override the changes inside your script. Not all of the configuration directives can be changed using ini_set() though.
Use an .htaccess file in your directory to override the configurations in php.ini file.
(certain parts adapted from #1438393)
Hope this helps!
I'm not sure you understood the post. The post means if you run the server and want a per domain php.ini you can run the module as a per domain so each user controls there domain php.ini however it looks like your server does not offer this so you will need to us htaccess file to overwrite the php.ini settings.
By over write this doesn't mean you can change the directory this means maybe add a module or add error reporting ect...
You can do it by using this post: How can I use xdebug to debug only one virtual host?

Categories