Plugin Author
Dylan
(@dyland)
What error did it report? Have at look at your error logs, if you can give me a line number I can check to see what could be causing an issue.
I had the same issue and disabled the plugin the same way and then stumbled on this thread after.
From error.log:
PHP Parse error: syntax error, unexpected ‘.’, expecting ‘,’ or ‘;’ in /var/www/mywebsitehere.com/public_html/wp-content/plugins/wp-content-security-policy/includes/wpCSPclass.php on line 39
Plugin Author
Dylan
(@dyland)
Line 39 in wpCSPclass.php version 1.9 is empty.
It might be the line
const ROUTE_NAMESPACE = ‘wpcsp/v’ . self::ROUTE_VERSION;
According to the PHP manuals constant expressions were introduced in PHP 5.6, so if your host is running an old version of PHP it might trip on that code.
That line can be replaced by
const ROUTE_NAMESPACE = ‘wpcsp/v1’;
I’ll put that in version 2.0 that’s coming out on Monday
Hm – I looked at my readme.txt and it only has up to 1.8 in the changelog. However it only broke about a week ago. I’m not sure if that when I upgraded to 1.8 or if 1.8 recently had come out. Either way, hope that helps.
I removed 1.8, put in 1.9 stock and it would not let me activate it. I did change line 43 in 1.9 to const ROUTE_NAMESPACE = ‘wpcsp/v1’; but I get:
Plugin could not be activated because it triggered a fatal error.
Parse error: syntax error, unexpected ‘/’, expecting ‘,’ or ‘;’ in /var/www/mysite.com/public_html/wp-content/plugins/wp-content-security-policy/includes/wpCSPclass.php on line 43
– WordPress version is 4.9 running on Centos 7 if that makes any difference.
– PHP Version 5.4.16
I also think it’s awesome that you read the forums!
Plugin Author
Dylan
(@dyland)
I found a host with PHP 5.3 and it does appear to be that one line. I have fixed it on version 2.0 and tested on PHP 5.3. Try fixing it again manually. Or wait until Monday and version 2.0 will be out.
Plugin Author
Dylan
(@dyland)
Version 2.0 is out – let me know if your issue persists.
Thank you very much. It is solved on my site.