Quantcast
Channel: WampServer - WampServer English
Viewing all 7480 articles
Browse latest View live

How to install PHP 8 in Wampserver and have it run side by side (no replies)

$
0
0
In this topic I'll explain how to get PHP 8 working within Wampserver and be able to switch between it and other versions of PHP.

EDIT: Fixed instructions for Wampserver 3.2.2.
EDIT2: Added missing extensions reported by Wampserver to phpForApache.ini.

Disclaimer: Wampserver does not officially support PHP 8 yet, so do this at your own risk. This guide is written for PHP 8.0.0 alpha 1. Things may change for newer preview releases, though I'm not expecting it to between now and the stable release. This is also for advanced users. If you don't know what you are doing, you may hose your Wampserver installation. If you have any doubts, I'd advise you to wait until PHP 8 stable when there should be an official Wampserver installer for it.

Pre-requisites: You need the latest Microsoft Visual C++ Redistributable for Visual Studio 2015, 2017 and 2019, which you can find on this page. Install the one applicable to your Wampserver installation.

Next you need to download the PHP 8.0.0 alpha 1 zip. You can find Windows binaries for preview PHP versions on this page. I normally recommend getting the thread safe version, but again pick the one that's applicable.

Once downloaded, navigate to your Wampserver folder and then go to bin\php, then create a new folder within called php8.0.0alpha1. For default 64-bit Wampserver installations this will be located at C:\wamp64\bin\php. Open the zip archive you've just downloaded and extract the contents to this new folder.

Normally if you're manually installing a new version of PHP this way, you can copy wampserver.conf and create a new phpForApache.ini file, then refresh Wampserver and call it a day. However, PHP 8 will not work out of the box by doing this and there a few extra steps that need to be done first.

Instead, you should create a new wampserver.conf file inside the php8.0.0alpha1 folder and paste the contents from below:
<?php

$phpConf['phpIniDir'] = '.';
$phpConf['phpExeDir'] = '.';
$phpConf['phpConfFile'] = 'php.ini';

//PHP 8 needs Apache 2.4.x and doesn't works with Apache 2.2.x
//and php_module, not php7_module or php5_module
$phpConf['apache']['2.4']['LoadModuleName'] = 'php_module';
$phpConf['apache']['2.4']['LoadModuleFile'] = 'php8apache2_4.dll';
$phpConf['apache']['2.4']['AddModule'] =  '';

?>
The difference is that PHP 8 has renamed php7_module to php_module and php7apache2_4.dll is now php8apache2_4.dll.

Next you should copy php.ini-development and rename the copy to phpForApache.ini. This is so that you have a fresh config file as a template. It will need changing in a few places in order to point to the correct folders. Look for the following lines and make these changes so that PHP 8 understands the Wampserver folder hierarchy. I'm using the paths for the default 64-bit Wampserver installation, so change these to wherever you have it installed.
error_log ="c:/wamp64/logs/php_error.log"
extension_dir ="c:/wamp64/bin/php/php8.0.0alpha1/ext/"
upload_tmp_dir ="c:/wamp64/tmp"
sendmail_from ="admin@wampserver.invalid"
session.save_path ="c:/wamp64/tmp"
soap.wsdl_cache_dir="c:/wamp64/tmp"
[opcache]
zend_extension="c:/wamp64/bin/php/php8.0.0alpha1/ext/php_opcache.dll"
You probably want to enable the same extensions as you did with PHP 7.x as well. This is how I have it set up.
extension=bz2
extension=curl
extension=com_dotnet
;extension=dba
;extension=enchant
;extension=ffi
;extension=ftp
extension=fileinfo
extension=gd2
extension=gettext
extension=gmp
extension=intl
extension=imap
extension=ldap
extension=mbstring
extension=exif      ; Must be after mbstring as it depends on it
extension=mysqli
;extension=oci8_12c  ; Use with Oracle Database 12c Instant Client
;extension=odbc
extension=openssl
;extension=pdo_firebird
extension=pdo_mysql
;extension=pdo_oci
;extension=pdo_odbc
;extension=pdo_pgsql
extension=pdo_sqlite
;extension=pgsql
;extension=phpdbg_webhelper
;extension=shmop

; The MIBS data available in the PHP distribution must be installed.
; See [www.php.net]
;extension=snmp

extension=soap
extension=sockets
;extension=sodium
extension=sqlite3
;extension=sysvshm
;extension=tidy
extension=xsl
;extension=zend_test

;zend_extension=opcache
You can configure the rest of the file as you see fit. I normally set these variables just for QoL.
max_execution_time = 120
post_max_size = 32M
upload_max_filesize = 32M
With that, PHP 8 is configured but it will still not work properly with Wampserver out of the box. Do not switch Wampserver to PHP 8 just yet, as you may not be able to switch back. To fix this, you will need to edit a couple of scripts in order to get them compatible.

Go to the root folder where Wampserver is installed (C:\wamp64 for default 64-bit installations). I recommend backing up the scripts folder within here in case you need to revert as a couple of scripts inside need to be changed. Bear in mind that you're going to be hacking these script files, so if you mess up it could cause Wampserver to stop functioning properly. Be sure you know how to recover in the event of this breaking something before you proceed. Also note that Wampserver updates may overwrite the scripts you will be modifying.

Navigate to the scripts folder.

Editing wampserver.lib.php was required for Wampserver 3.2.0, but is no longer needed if you update it to 3.2.2.
The main file that needs to be changed is wampserver.lib.php. You need to look for the following line (line 272 for me, but it may be different for you).
		if (strpos($line,'LoadModule') !== false && (strpos($line,'php5_module') !== false || strpos($line,'php7_module') !== false))
Change this to the following:
		if (strpos($line,'LoadModule') !== false && (strpos($line,'php5_module') !== false || strpos($line,'php7_module') !== false || strpos($line,'php_module') !== false))
Now you'll be able to switch between PHP 8 and other versions within Wampserver without it getting stuck.

For good measure, there's one more script left to edit. Open config.inc.php and look for these lines:
$phpDllToCopy = array_merge(
	$php_icu_dll,
	array (
	'libmysql.dll',
	'libeay32.dll',
	'ssleay32.dll',
	'libsasl.dll',
	'libpq.dll',
	'libssh2.dll', //For php 5.5.17
	'libsodium.dll', //For php 7.2.0

	'libsqlite3.dll', //For php 7.4.0

	'php5isapi.dll',
	'php5nsapi.dll',
	'php5ts.dll',
	'php7ts.dll', //For PHP 7
	)
);
This needs php8ts.dll adding to the end of the array like this:
$phpDllToCopy = array_merge(
	$php_icu_dll,
	array (
	'libmysql.dll',
	'libeay32.dll',
	'ssleay32.dll',
	'libsasl.dll',
	'libpq.dll',
	'libssh2.dll', //For php 5.5.17
	'libsodium.dll', //For php 7.2.0

	'libsqlite3.dll', //For php 7.4.0

	'php5isapi.dll',
	'php5nsapi.dll',
	'php5ts.dll',
	'php7ts.dll', //For PHP 7
	'php8ts.dll', //For PHP 8
	)
);
Then finally at the end of the same file, there's another line that needs changing.
// Apache modules which should not be disabled
$apacheModNotDisable = array(
	'authz_core_module',
	'authz_host_module',
	'php5_module',
	'php7_module',
	);
This just needs php_module adding to the end of the array like this:
// Apache modules which should not be disabled
$apacheModNotDisable = array(
	'authz_core_module',
	'authz_host_module',
	'php5_module',
	'php7_module',
	'php_module',
	);
And that should be it. Right click Wampserver in the system tray and select Refresh. It should pick up PHP 8. Then you should be able to switch to and from it just like any other version of PHP.

One note is that JIT compilation is turned on by default within the php.ini file so you should see a decent performance improvement over PHP 7.4.

This guide should work for newer preview releases of PHP 8. They just need the paths changing to reflect that version.

Happy testing! :)

Wampserver32 (no replies)

$
0
0
Hello
I'm here to ask why my Wampserver32 don't stay green? It don't leave the orange!
Thank you.

What is this issue? (1 reply)

$
0
0
Hi,

When I am running the PHP project, I cannot see the output. It shows me the PHP code.
Please, anyone can give me the reason for that.

Thank you

How to only run SSL on a certain domain? (no replies)

$
0
0
How to only run SSL on a certain domain? I run my website on the domain, but when I run it on localhost it always runs SSL, I don't want SSL on localhost. Is there any way to combine <If "%{HTTP_HOST}=="mydomain"> with <IfModule mod_rewrite.c>?

WAMP Warning and Fatal Error messages (no replies)

$
0
0
Working on a localhost site with a fresh install of WAMP64. Changed c:/wamp64/www to F:/Sites/ and now have the following errors that I can't make heads or tails of....

Warning: require(../scripts/config.inc.php): failed to open stream: No such file or directory in F:\Sites\add_vhost.php on line 10

and

Fatal error: require(): Failed opening required '../scripts/config.inc.php' (include_path='.;C:\php\pear') in F:\Sites\add_vhost.php on line 10

I'm lost here. Any help would definitely be appreciated. Thanks.

( ! ) Fatal error issue (no replies)

$
0
0
Back again with another one. Can't get into the backend of my localhost site because of these error messages. I'm guessing, I need to create the missing table and fill it with what I don't know? Help here would be appreciated. Thanks.

( ! ) Fatal error: Uncaught RuntimeException: Error saving action: Table 'jprincedb.wpmrsport_actionscheduler_actions' doesn't exist in C:\wamp64\www\mr-sport\wp-content\plugins\woocommerce\packages\action-scheduler\classes\data-stores\ActionScheduler_DBStore.php on line 75
( ! ) RuntimeException: Error saving action: Table 'jprincedb.wpmrsport_actionscheduler_actions' doesn't exist in C:\wamp64\www\mr-sport\wp-content\plugins\woocommerce\packages\action-scheduler\classes\data-stores\ActionScheduler_DBStore.php on line 75

line 75 has this....
throw new \RuntimeException( sprintf( __( 'Error saving action: %s', 'woocommerce' ), $e->getMessage() ), 0 );

Here's the whole....
return $action_id;
} catch ( \Exception $e ) {
/* translators: %s: error message */
throw new \RuntimeException( sprintf( __( 'Error saving action: %s', 'woocommerce' ), $e->getMessage() ), 0 );

Microsoft Discontinuing Support of PHP (1 reply)

$
0
0
Hello, I am new to posting in forums (in fact this is my first one ever). I run several instances of WAMP on windows systems, one is pretty critical. It came to my attention today that Microsoft is planning on discontinuing support for PHP. I am very curious if this will affect WAMP and if so what the alternatives are? Any thoughts? Thanks everyone! Dave

Upgrade 3.2.0 to 3.2.2 (1 reply)

$
0
0
Hello,

I need to upgrade php to 7.3.18 so I was requested to upgrade my wampserver from 3.2.0 to 3.2.2. I have all the C++ prerequisites and the installation was successful. I was also able to install 7.3.18 php addon as well. However, wampserver GUI is still showing 3.2.0 and php 7.3.18 is not showing in GUI php version options to switch to. Even though I can see it installed in the filesystem. wampserver.conf is showing:

wampserverVersion ="3.2.2"
installVersion ="3.2.0"

Is it possible to switch to new php version just by editing wampserver.conf file in the php section? Or a complete reinstall is needed? Are there any other options?


Thanks

SSH2 (no replies)

$
0
0
Hello, don't find how to connect SSH2 with WAMP using Windows. In services i see in right way "PHP_SSH2" but when I run my script, Fatal error: Call to undefined function ssh2_connect() in C:\wamp\www\.... .
Some help me please? Thanks

Index of / (no replies)

$
0
0
Suddenly I'm getting 'Index of /' instead of wampserver localhost page or any of my virtual host pages.

Fatal error: Uncaught WC_Data_Exception (no replies)

$
0
0
Did a complete fresh wp install on localhost. Then used my all-in-one-migration plugin to transfer my online site to localhost and got the following error messages....

Fatal error: Uncaught WC_Data_Exception: Invalid billing email address in F:\Sites\mr-sport\wp-content\plugins\woocommerce\includes\abstracts\abstract-wc-data.php on line 810
( ! ) WC_Data_Exception: Invalid billing email address in F:\Sites\mr-sport\wp-content\plugins\woocommerce\includes\abstracts\abstract-wc-data.php on line 810

Can't access the backend in order to install an email service. Not sure how to deal with this?

Any help would be appreciated. Thanks.

How to tell if I'm really online? (1 reply)

$
0
0
Wamp is showing green in the taskbar.
I've only just changed over the domain dns to reflect my IP.
How/When will I know if my websites are 'online'/wamp is working and when the dns has fully changed over?

I mean the dns could have fully changed over but my vhosts edit could be wrong.
Would wamp return a ping to my external IP?
I ping my domain name and it shows the external IP but packets are lost,at this point in time.

How do I configure the correct ports for wamp server, please? (1 reply)

$
0
0
Hello. I think I know why the wamp server won't open. I need to assign the correct port to it.
Can someone please help me to assign the correct port? I have no clue on how to do this. Thank you.

No longer wampserver (1 reply)

$
0
0
With your agressive logon policy I can no longer promote WampServer to my (new) stundents. Although you have a great product, XAMPP has A better no hassle deal.

Let me know when you will offer WampServer downloads without having to register and I point my yearly 100+ students to you again.

Such a shame

upgrade from 3.1.7 to 3.2.0 (1 reply)

$
0
0
Hi There,

If I download the 3.2.0 installer and install on same folder will upgrade it without loosing any existing data/projects?

Thanks
Jaya

How to restart PHP from Windows 10 WAMP tray icon? (no replies)

$
0
0
I see how to restart all services or the DNS server locally, but I just want to restart PHP, not Apache and MySQL. Is that possible from left/right-click of the green W icon at the bottom right?

sqlsrv_connect() (no replies)

$
0
0
Hello everyone, I recently upgraded to PHP 7.4.8 / Apache 2.4.43a. After I downloaded & installed all the binaries (VC_redist.x86.exe & VC_redist.x64.exe), updated both the php.ini & phpForApache.ini to reflect the new Microsoft SQL server drivers for version 7.4.8, and restarted WAMP several times, I continue to get the error "Fatal error: Uncaught Error: Call to undefined function sqlsrv_connect() in C:\wamp64\www\db.php on line 5". Would anyone have an idea as to what may be happening? I can still run my website with the old version of PHP 7.2.18 but I'd like to have the upgraded version up and running.

Any help is appreciated. THANKS! Dave

Undefined index: ServerName in C:\wamp64.... (no replies)

$
0
0
Hello,

On my localhost site I get the following error message: 'Sorry, you are not allowed to access this page.'

In my php error log I have the following:
PHP Notice: Undefined index: ServerName in C:\wamp64\scripts\wampserver.lib.php on line 558.The same message for line 559.

558: $SerName = $virtualHost['Server'][$key]['ServerName'];
559: $DocRoot = $virtualHost['Server'][$key]['DocumentRoot'];


Any idea what's going on here and how to fix this would definitely be appreciated. Thanks.

php.ini in green WAMP icon left-click apparently not the same as running one (1 reply)

$
0
0
I'm not seeing how to attach a screenshot, but in the Windows 10 system tray WAMP icon, left-clicking into the php.ini option:
[imgur.com]

I commented out the uncommented line:
error_reporting = E_ALL

and added a new setting (to suppress warnings):
error_reporting = E_ERROR | E_PARSE

However, after restarting the Apache service (and also after restarting all services) the VirtualHost site I'm running still shows PHP warnings.

When I left-click into "PHP settings" (above the "php.ini" left-click option), it shows error_reporting as E_ERROR...
[imgur.com]


Am I supposed to restart Windows? I'm not sure whether it's using the same file or just not reloading the php.ini file... and I'm not seeing an option to just reload the php.ini file.

Possible errors with PHP (1 reply)

$
0
0
Hi there,

I am using a local virtual host and normally I experiment with this site to check things. I have installed Wordpress and suddenly I was unable to update or download any plugin or theme.

I know you will tell me that this problem is not related to Wamp but Wordpress, and you are right. Unfortunately I posted this issue on their forum website a week ago and nobody answered yet. I tried myself to sort out the problem by searching online but nothing seems to match the issue I am experiencing

In other forums they blame the file and directory permission and ownership issues. I am not using any FTP and I don't know how to access to my hosting management file manager,
As I said, I never encounter this problem before, and all this started when i tried to change the name of the local virtual host.

The other answer I got from other websites points to PHP settings, like upload_max_filesize setting, and max_ execution_time:
i tried to change both but I only achieved to change the message error. So I decided to reset the values as they were.

I also deactivated all plugins but the problem still remains. One last thing I tried to do was to start all over again by deleting the site, and creating a new virtual host. This normally fix everything but not this time.

The error message I get are those:

Theme

Installation failed: Could not copy file. twentytwenty/assets/images/2020-landscape-1.png

Plugin

Installation failed: Could not copy file. akismet/changelog.txt

I hope you could help me on this even though it seems is a Wordpress issue. t would appreciate a lot, If at least, I could get a link where I could search for advice.

Thanks a lot for you time
Viewing all 7480 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>