problem when restarting apache by updating php code - php

Good evening friends, I need your help since I have a problem with a webservice mounted in centos 6.9 with the version of apache 2.2.15 and php 5.5.38.
Before when doing any code I only loaded it and it worked immediately, I had a vacation and a partner of the work made a modification to that server that now every time you update a file, it is required to restart the apache so that you can apply the changes
Currently the partner does not work in the company and I need to replace the apache as it was by default.
They have some idea of ​​how to solve this problem.
Thank you for your cooperation

It sounds like you have the opcache extension enabled.
You can remove the extension or tell opcache to check your file for changes every time its loaded by adding
opcache.revalidate_freq=0 your php config

info
check the php.ini and the function php_opcache.dl is the one that is configured under
zend_extension = php_opcache.dl
the php.ini image is appended

problem solved.
the file opcache.ini was modified in the path /etc/php.d/opcache.ini and the option opcache.enable was set to 0 and that's it, it works correctly thank you very much.

Related

Editing php.ini with MAMP 3.5 where is the right ini file?

I'm trying to edit my php.ini file to turn off short tags. Pretty standard.
phpinfo() tells me I am running PHP Version 5.6.10
I have edited 2 php.ini files so far, and neither has taken effect (yes, I restarted MAMP)
MAMP/conf/php5.6.10/php.ini
MAMP/bin/php/php5.6.10/conf/php.ini
Neither file changes the status of short tags
Can anyone direct me where/how to change my php.ini settings?
I really freaking miss WAMP. Whose bright idea was it to buy a Mac?!?
When you run phpinfo() you need to look for the value Loaded Configuration File. This tells you which php.ini file PHP is using in the context of the web server.
Aaannnnnnnnddddd I was being a dufus
I had been commenting the line out instead of changing to "Off"
as you version is 5.6.10, and supposed your apache2 server runing on ubuntu.
php.ini dir is
/etc/php5/apache2/php.ini
On my Mac, running MAMP I have a few locations that would contain the likely php.ini
So I edited the memory_limit to different values in the 2 suspected files,
to test which one effected the actual MAMP PHP INFO page details.
By doing that I was able to determine that this was the correct php.ini:
/Applications/MAMP/bin/php/php7.2.10/conf/php.ini

Stop caching for PHP 5.5.3 in MAMP

Installed MAMP on a new Macbook with PHP 5.5.3.
Reload and refresh do nothing. Still nothing. Google around for a few minutes trying to find out what is wrong, come back and refresh. It works. What the heck?
I went into php.ini and disabled all the new OPcache and set the default cache time to 0. Added headers to the document to force no caching. Still same problem. What the heck is going on here?
The network tab is showing a HTTP 200 request, so any new HTML in the index.php file renders fine, but new PHP that needs to be rendered by the server is delayed and not rendered until some predetermined set of time passes that I don't know how to change. What's going on?
I checked this in Safari too so it is definitely a server thing that is keeping the file from rendering.
Interesting fact though, if I go into MAMP and change the PHP version to the old one (PHP 5.2 or something) it will render normally, with no "caching issues". Switch to PHP 5.5 and it hangs up. In the MAMP preferences caching options for 5.5 don't even exist and are automatically disabled.
Disable OPCache
MAMP now turns on OPCache by default, you can disable it by editing your php.ini file. Make sure you edit the correct php.ini.
I was running into the same problem myself. MAMP with PHP version 5.5.3 runs OPcache by default, but you can't turn it off in the GUI like you can with the older PHP version 5.2.17. You have to manually comment out all the OPcache lines at the end of the php.ini file (MAMP/bin/php/[version]/conf/php.ini) and make sure to stop and start the servers for the changes to take effect.
I updated the URI, the changes can be reflective by also changing /conf/ under the php folder, but it seems MAMP will ignore these after restart.
I added opcache_reset(); in my main PHP to stop this caching.
Removing it from php5.5.3/conf/php.ini did nothing for me.
Edit
Turns out there also is a /Applications/MAMP/bin/php/php5.5.3/conf/php.ini. It
works if I comment it out there.
1) in /Applications/MAMP/bin/php/php5.5.3/conf/php.ini
2) set opcache.revalidate_freq=0
3) restart MAMP
Took me so long to figure out it was a MAMP problem! Why would OPcache be enabled by default-- and require php.ini tinkering to disable-- in an app that's supposed to be used for testing websites? Anyway, I read through this whole thread and tried the various solutions.
Here are my notes on how each solution works and considerations for selecting a solution.
Each solution works on its own; no need for redundancy.
Webpage code solution
opcache_reset();
<?php opcache_reset(); ?>
Must be added in the webpage code.
Forces all scripts to be reloaded.
Works without restarting MAMP server.
Server configuration solutions
Important: Use the php.ini file in /Applications/MAMP/bin/php/php5.5.3/conf/php.ini and not in
/Applications/MAMP/conf/php5.5.3/php.ini. Adjust accordingly if you're using a different version of PHP.
enable=0
[OPcache]
zend_extension="/Applications/MAMP/bin/php/php5.5.3/lib/php/extensions/no-debug-non-zts-20121212/opcache.so"
opcache.memory_consumption=128
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=4000
opcache.revalidate_freq=60
opcache.fast_shutdown=1
opcache.enable_cli=1
enable=0
Must be added under [OPcache] in php.ini.
Disables OPcache.
Requires MAMP server restart.
opcache.revalidate_freq=0
[OPcache]
zend_extension="/Applications/MAMP/bin/php/php5.5.3/lib/php/extensions/no-debug-non-zts-20121212/opcache.so"
opcache.memory_consumption=128
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=4000
opcache.revalidate_freq=0
opcache.fast_shutdown=1
opcache.enable_cli=1
Modify opcache.revalidate_freq under [OPcache] in php.ini.
Makes OPcache check for updates every 0 seconds instead of every 60 seconds.
Requires MAMP server restart.
Commenting out [OPcache]
;[OPcache]
;zend_extension="/Applications/MAMP/bin/php/php5.5.3/lib/php/extensions/no-debug-non-zts-20121212/opcache.so"
;opcache.memory_consumption=128
;opcache.interned_strings_buffer=8
;opcache.max_accelerated_files=4000
;opcache.revalidate_freq=60
;opcache.fast_shutdown=1
;opcache.enable_cli=1
Comment out the entire [OPcache] section in php.ini.
Removes OPcache from the PHP server.
Requires MAMP server restart.
Considerations
Choose the webpage code solution if:
You just need to force script refreshing for a particular project
You don't want to restart the MAMP server
You don't want to edit php.ini
Choose a server configuration solution if:
You want to disable caching by default instead of having to do it in every project
You're comfortable with editing php.ini
I personally prefer enable=0 since it's the simplest solution for me, and I need caching disabled by default.
References
http://php.net/manual/en/function.opcache-reset.php
http://php.net/manual/en/opcache.configuration.php
It looks like this is finally a GUI option. MAMP 3.0.7.2 for Mac OS X.
It was painful spending around 1 hour trying to figure out what could it be.
I just added this at the end of the code and restart MAMP.
opcache.revalidate_freq=0
opcache_reset();
Edit "/Applications/MAMP/conf/php5.5.3/php.ini", and search for [OPcache] and add this code under it directly:
opcache.enable=0
This will disable opcache in when use PHP in MAMP server.
Oh man am I glad I found this thread! I was pulling my hair out! I just upgraded MAMP yesterday and didn't notice this caching issue until today while working on a project. Thought I was losing my mind.
I just changed "/Applications/MAMP/conf/php5.5.3/php.ini" very bottom of file opcache.enable=0
This is also current in the Windows version of MAMP as well.
C:\MAMP\conf\php5.6.3\php.ini
It's listed at the very bottom of the file.
The other problem I found, was on a QNAP NAS TS-431. This caching is also enabled, and if you are working with dynamically changing files, or try to develop on it, you'll be ripping out your hair. As per the other comments, just comment it out. The setting is located in:
Control Panel/Applications/Web Server/PHP.ini Maintenance.
Once again, you'll find the settings at the bottom of the file.
For those using MAMP 6.x you have to disable the setting in the UI otherwise MAMP will overwrite your PHP files the next time you restart apache.
The setting is in the PHP setting as shown here:
Change the default OPcache setting to off and click Save. After saving restart the Apache service.
Open your Mamp panel
on the right top corner click "Preferences"
a pop will open ,there is a option to "off" the php cache.
It works like charm,No need to modify any other files.

How to make the server load php from another directory?

I have a dedicated server and I'm facing a strange issue. I found there 2 php installations and only one must be used and is correct, which is version 5.2.6, but currently, I see on phpinfo that the php.ini is being loaded isn't the right configuration. The php.ini which I need the server use is located in /opt/php-5.2.6/config/php.ini and the current in use is located in /etc/php.ini. How to turn on the php located in /opt/php-5.2.6/ ? I don't know what happened, maybe after I tried to install the xCache extension, but didn't work and in some way that installation of xCache changed where the php is loaded from.
How to make loading the php which I have in directory /opt/php-5.2.6/ ?
Thanks.
You can make your apache to point to another php.ini using .htaccess file.

Weird ungrammatical PHP error msg when trying to set upload folder

I've been getting this error, verbatim:
// PHP setup Edit php.ini (try /usr/local/php5/lib/php.ini search for "tmp" and make sure file uploads are, and that you have a tmp director of that name, with permissions set. To load the new php.ini, restart apache: apachectl restart
What's weird about this, besides the grammatical flaws, is that I get it no matter what I set upload_tmp_dir to in php.ini...or even if I remove php.ini entirely.
I do an apachectl restart after each change. I've also tried rebooting.
I believe I'm editing the right php.ini, because it's the one listed when I do a phpinfo(): /usr/local/php5/lib/php.ini. It lists whatever upload directory I edit into it.
This happens under Mac Lion with both Chrome and Firefox
phpinfo tells me I'm running PHP Version 5.4.6
I am the opposite of an expert.
Thanks for whatever help you can give me. I am preparing to D'oh slap myself.
It was indeed a comment in a buried file. Aaarrrggghh! Thanks to do those who offered suggestions. I am equally grateful and embarrassed.

XAMPP and cURL not working, after uncommenting php.ini

Someone else with the same problem still didn't get a decent answer/fix for my problem:
Before you comment or criticize, please make sure you read my proceedures below so as not to repeat what I've seen 100x already in Google and Stack Overflow...
XAMPP (Lite) installed on Windows 7 in C:\xampplite (newest version, only one php.ini file in C:\xampplite\php)
XAMPP and PHP scripts run correctly in http://localhost/
libcurl installed (by XAMPP default) in C:\xampplite\php\ext\php_curl.dll
php.ini edited and saved for removal of ; at beginning of line extension=php_curl.dll
php.ini default for extension_dir = "C:\xampplite\php\ext" correct and left alone
Apache service restarted in Windows Services
Computer restarted
Apache service (manually) restarted again
phpinfo(); still does not display anything with the word "curl" in it
Still no success
Thanks in advance.
I had the exact same problem but could not find the solution online.
Every site I saw said to uncomment "extension=php_curl.dll" which didn't fix the problem.
I finally solved it by adding the path to curl.dll to the variable.
That is, I changed: extension=php_curl.dll
to:
extension="F:/WebServer/PHP/ext/php_curl.dll"
Hope this helps you or somebody else.
I had a similar problem except for error reporting. Searched all over the internet and all I found was "modify the php.ini file". I modified all the php.ini files but I was still getting the same error. Turns out WAMP has visual settings which I believe overwrite the php.ini. So to turn on curl, you'd left click on XAMPP icon in your start start menu -> PHP -> PHP Settings -> php_curl (make sure it is checked).
Maybe this is your problem.
Hope it helps.
-c0d3
Try executing curl
xampp/apache/bin/curl.exe
with admin privileges.
Restarting the PHP server will do.

Categories