file_get_contents() works on Local but not on server [duplicate] - php

This question already has answers here:
Warning: file_get_contents(): https:// wrapper is disabled in the server configuration by all
(6 answers)
http:// wrapper is disabled in the server?
(1 answer)
Server configuration by allow_url_fopen=0 in
(6 answers)
file_get_contents works on Local but not on server [duplicate]
(4 answers)
Should I allow 'allow_url_fopen' in PHP?
(5 answers)
Closed 5 years ago.
I have finished my client project with laravel and after many test in local all works good , but after hosting project to serve show this error :
ErrorException (E_ERROR)
file_get_contents(): https:// wrapper is disabled in the server configuration by allow_url_fopen=0 (View: /htdocs/resources/views/welcome.blade.php)
Please help me .

allow_url_fopen is disabled (for good reason) on most productions servers. You shouldn't use it for getting files over URL. Use CURL fo it instead

Related

Error when updating from PHP 5.4 to 7.4: "Your PHP installation appears to be missing the MySQL extension which is required by WordPress." [duplicate]

This question already has answers here:
Error : Your PHP installation appears to be missing the MySQL extension which is required by WordPress
(7 answers)
Why shouldn't I use mysql_* functions in PHP?
(14 answers)
Closed 2 years ago.
I recently updated my site hosted on HostGator from PHP 5.4 to 7.4. I got this error:
Warning: Use of undefined constant WP_CONTENT_DIR - assumed 'WP_CONTENT_DIR' (this will throw an Error in a future version of PHP) in /home1/keziavida/public_html/wp-includes/load.php on line 115
Your PHP installation appears to be missing the MySQL extension which is required by WordPress.
Deprecated: Directive 'allow_url_include' is deprecated in Unknown on line 0
Does anyone know how to fix this?

file_get_contents cannot get a resourse over https [duplicate]

This question already has answers here:
How to get file_get_contents() to work with HTTPS?
(12 answers)
Closed 5 years ago.
I'm trying to run the following code to get the html of a web page:
$html = file_get_contents("https://www.bet365.com");
But I get these warnings:
PHP Warning: file_get_contents(): SSL:
PHP Warning: file_get_contents(https://www.bet365.com): failed to open stream: HTTP request failed!
I've tried setting stream context with different headers, but cannot find a workig solution. What might be the reason for this warning and how can I solve it.
This was an enormously helpful link to find:
http://php.net/manual/en/migration56.openssl.php
An official document describing the changes made to open ssl in PHP 5.6 From here I learned of one more parameter I should have set to false: "verify_peer_name"=>false
Similar post Visit it

sqlsrv in Registered PHP Streams [duplicate]

This question already has answers here:
"Call to undefined function sqlsrv_connect()" when trying to connect to Azure DB from PHP
(2 answers)
Closed 6 years ago.
How can I get sqlsrv in Registered PHP Streams of my php installation?
I am getting the following error:
Fatal error: Call to undefined function sqlsrv_error() in C:\inetpub\wwwroot\twickenham2013\class\sqlsrv.class.php on line 14
How can I fix this?
Im facing the same issue.
Thats because the Registered PHP streams(phpinfo()) does not contain sqlsrv field.
this can be checked using the code
<?php
phpinfo();
?>
add the necessary .dll files in you xampp/php/ext. and edit the php.ini document.
To download the necessary .dll files and for more detailed installation instructions, see the PHP docs: http://php.net/manual/en/sqlsrv.installation.php

Admin panel not accessible in wordpress [duplicate]

This question already has answers here:
Reference - What does this error mean in PHP?
(38 answers)
Closed 9 years ago.
I have deployed the wordpress blog on my site sqlhelps.com. The site is hosted on asp.netdiscount server. I cannot access the sqlhelps.com/wp-admin. The error is as follows :
Warning: require_once(E:\web\sqlhelpscom\htdocs/wp-admin/includes/user.php): failed to open stream: No such file or directory in E:\web\sqlhelpscom\htdocs\wp-admin\includes\admin.php on line 60 Fatal error: require_once(): Failed opening required 'E:\web\sqlhelpscom\htdocs/wp-admin/includes/user.php' (include_path='.;C:\php\pear') in E:\web\sqlhelpscom\htdocs\wp-admin\includes\admin.php on line 60
Can anyone please help me out with this?
Either user.php is not available on your server or you are giving the wrong path as you can see error is :
No such file or directory in E:\web\.......
In E:\web\sqlhelpscom\htdocs\wp-admin\includes\admin.php on line 60, try changing
require_once(E:\web\sqlhelpscom\htdocs/wp-admin/includes/user.php)
to
require_once(E:\web\sqlhelpscom\htdocs\wp-admin\includes\user.php)
so all the slashes are going the same way.
Jason

How to check if the remote server images exist? [duplicate]

This question already has answers here:
How can one check to see if a remote file exists using PHP?
(24 answers)
Closed 9 years ago.
I am trying to test if the remote images exist before I process my codes..
I have found this post
How can one check to see if a remote file exists using PHP?
I have tried getimagesize function and file_get_contents function but I got
Warning: getimagesize() [function.getimagesize]: http:// wrapper is disabled in the server configuration by allow_url_fopen=0 in /project/testImages.php on line 147
I can't modify the server configuration in my case.
I am not sure how to solve the errors or if there are another ways to workaround.
Thanks for any help.
Why don't you try cURL with CURLOPT_HEADER set to 1 (or true)? Then just check the returned contents for server response. That's the way I'd do it.

Categories