Restart Specific Version of PHP/Apache? - php

I just installed PHP version 5.5 on my server (Centos 6 / Plesk 12) and changed the php version for one of my sites. I can see via a php info file that the site IS using the new PHP version, but I don't know how to start that VERSION of php. I made some changes to PHP5 ini file but when I restart apache, it restarts the old version (php 5.4) and not php5.5 ..sorry I am not the best at shell commands but does anyone know how to restart the NEW php version if i have multiple versions installed on the server? Thanks!
additional info- the changes that i made to the php5.5 ini file is loading the zend_extension opcache.so ..which is why i installed php 5.5 in the first place!
BONUS QUESTION: will zend opcache be effective running php 5.5 as fastcgi? I've heard that object cache modules are not compatible with fastcgi because it lets users run the application as their own user so the cache can not create x number of caches for each user..if that makes sense..lol
Thanks

Not sure if anyone is still following this but I also got stuck with this too. The solution I found to work was this:
Depending on what PHP versions you have setup with Plesk you need to run the following command:
service plesk-php{version}-fpm restart
For example:
service plesk-php54.fpm restart
or
service plesk-php56.fpm restart
In centos 7 the "service" command actually just calls another function so you end up calling:
/bin/systemctl restart plesk-php54-fpm.service
You can call that directly if you want but it is a few extra characters to type in.
With the above in mind you are now free to edit your php.ini files for each specific version you have enabled via Plesk. For those who don't know the ini files are usually located here:
/opt/plesk/php/{version}/etc/php.ini
Where {version} is 5.4, 5.5, 5.6, etc...
Hope this helps someone else.
In regards to your bonus question - sorry I'm not sure as I've not worked with that specifically.

Related

Multiple PHP / Apache Versions on MacOs

At the moment I'm using two machines for Web (Win10) & iOS development (MacOS) and looking to combine them into a one computer that I would use on a daily basis.
My current challenge is to ensure that I can develop and run two or more environments on the same machine (not necessary at the same time, a simple switch would do the job).
I've tried MAMP and AMPPS and they both do the job, with an exception to the PHP-CLI version.
Every time I run php from the console it opens up the latest version completely ignoring the one that is specified by the MAMP or AMPPS.
What is the best way to ensure that php-cli always points to a currently active version of the PHP as stipulated by MAMP or AMPPS?
On Windows I was using https://ospanel.io/ that had it's own internal terminal window that would automatically load the current version of php-cli.
I am fully aware of docker/vagrant but they would be an overkill in this case.
Thanks
Unfortunately there is no simple answer to my question. As a solution:
Get multiple version installed
Design a script that changes the PATH environment to the right version as required.
alternatively a script that rewrites a symlink to a required version of the PHP.
For MAMP user, you must edit the file /usr/local/etc/httpd/httpd.conf and set the PHP version you prefer to use in your stack. I only installed one version of Apache HTTPD with multiple PHP versions - you have to specify the version.
If you don't, the default is the Mac's pre-installed PHP version.

memcache, wamp, php 5.4, win8

I am using wamp, PHP 5.4 running on win 8,
I can't seem to get PHP to acknowledge the memcache dll.
I download php_memcache-3.0.8-5.4-ts-vc9-x86.zip (the only one I could find).
I copied the dll to C:\wamp\bin\php\php5.4.12\ext
I added extension=php_memcache.dll
restart the server.
but still I cannot use memcache, and it is missing from Loaded Extensions list.
Please supply a step-by-step instruction on how to set this up,
Thanks.
You have to install memcached as well.
php_memcached is only an interface to the memcached service that also has to be running on the system your Apache/PHP is running on.
This site seems to be offering a ready to go .exe
This may also help with getting it running

Adding a variable to httpd.conf file stops Apache from working

In my efforts to solve an OCI8 error, I've been led to believe it is the result of an improperly setup environment variable.
What I'm trying to do: Fix this apache environment headache, by adding variables to a certain file.
My actual problem is similar to this error from another StackOverflow user. To quote his answer to his problem:
Problem solved!
To put variables in Apache's Environment section you just have to add
them in /etc/sysconfig/apache2 file:
LD_LIBRARY_PATH=/path/to/oracle/lib.
Notably, the solution called for the modification of the file apache2.
However, I found no such apache2 file on my system.
What I've done so far:
I searched over the net, but the closest I could come up with is /etc/httpd/conf/httpd.conf file. Assuming the httpd.conf is apache2, according to this thread, I should add the variable to the end of the file, and it should work.
So I added export LD_LIBRARY_PATH=/u01/app/oracle/product/11.2.0/xe/lib at the very end of the file.
And... apache won't even start anymore.
My system:
It's a Fedora 19 server, with Oracle 11g, PHP 5.5.4, Apache 2.4.6, and PEAR 1.9.4. In addition to this, I have the OCI8 plug-in for PHP downloaded and enabled, and have downloaded MDB2 and the MDB2_Driver_oci8.
Apache starts automatically when I boot up my system, though if for some reason I need to stop, restart, or check its status, the command I use is systemctl start httpd.service, if it means anything.
Thanks. I've been pulling my hair out on this problem.
A few things (hopefully an answer is somewhere inside)
First off, I wouldn't do this on Fedora. Fedora is the testbed for RedHat Enterprise/CentOS and it changes frequently. Even if this is just for your testing purposes, you'll find better support if you install CentOS 6 instead. The environment is virtually identical, but CentOS is better supported because so many people use it to run their servers.
Second, it sounds like you want to run the OCI8 connector (there's a reason I plugged CentOS 6). CentOS has many good repos like Remi. If you install CentOS 6 you can use his repository. This is important because this will save you a LOT of headaches down the road. Once you have his repo installed, you can do this
yum install php-oci8
And that should configure Apache to run your OCI8 extension. It's really that simple.

Change PHP version in IIS 6

Trying to upgrade from PHP 5.2.5 to 5.2.17 (and then to 5.3.6 once that works) on IIS 6.0, installing the language itself runs just fine and I changed the PHP.ini/ect locations that IIS uses for PHP, everything still works but when I run PHP info on my site it still says it's running PHP 5.2.5. Restarted IIS, restarted the server even, no difference. What do I do to change which version/what location of PHP IIS is using?
When I install PHP 5.3.6 the site no longer works, so I know installing different versions is doing SOMETHING, but I think it might only be changing the PHP.ini my server is using, not the version of PHP.
In addition to installing the windows binary release of PHP I've also tried installing PHP from Microsoft's Web Platform Installer (both 5.3.6 and 5.2.17), after installing neither showed up as the current version in phpinfo either.
If you want to use php 5.3, you must install IIS FastCGI extension and run PHP as cgi script. From php 5.3 isapi is not supported. But everything works fine if you configure it, and as benefit you can use more php version simultaneously. IIS 6 is not a problem. Download PHP non thread safe.
For details see this, for example: http://learn.iis.net/page.aspx/247/using-fastcgi-to-host-php-applications-on-iis-60/
Download the latest VC11 x86 Non Thread Safe version of PHP from http://windows.php.net/download/
Once the zip is downloaded, right click on the zip file and select properties. Make sure you unblock the file.
Rename your current PHP folder to PHPold.
Find your php.ini file and rename it to phpold.ini
Extract the zip file to c:\temp\php.
Copy the php folder from c:\temp to wherever your old PHP folder was.
Go to your new php folder and copy php.ini-production and paste it to where your old php.ini file was
Rename php.ini-production to php.ini
On the server, make sure you have Notepad++ along with the Compare plugin. If you need the compare plugin, use these steps. http://www.davidtan.org/how-to-compare-two-text-files-using-notepad-plus/
In the location that stores your phpold.ini and php.ini, right click on each of those files and open them with Notepad++. On the php.ini, only make changes to the lines with the >> next to them.
Once the changes have been made, make sure you save php.ini.
Go to Services and restart IIS.
Solution has been to move to Apache in my case. IIS 7 has better tools but IIS has proven to be a poor environment for development in this case.

Installing IonCube on IIS7 / Windows Server 2008

we've inherited a PHP project from a client that requires IonCube. Our boxes all run on IIS7 and although we've followed the instructions for configuring it, it isn't loading the decoder library. Have any of you had any success with getting IonCube up and running on Win 2k8 (32bit)? I'm pulling my hair out over this so any help would be beyond appreciated.
Thanks
For anyone attempting to do this in the future, here is what you must do:
Determine if you are running a thread-safe version of PHP. You can check that by accessing your php_info or the file they provide. If you are not running a threadsafe version continue:
Download the non-ts version (non-threadsafe version) from the typical download page (there are two version available)
Put the Dlls inside of your Windows\System folder (i put mine in a subfolder)
Add the line zend_extension = C:\Windows\System32\ioncube\ioncube_loader_win_5.2.dll
note that it is NOT zend_extension_ts and is zend_extension instead
restart IIS
Run their ioncube-loader-helper.php file to verify that it worked properly.
Enjoy.

Categories