I started a PHP project few days back. It works perfectly fine on my localhost. But after I uploaded my files on Godaddy (Plesk) server, a few scripts are not working. I used cURL for the pages and I am guessing that cURL is disabled on the server. I tried to find the php.ini file on the server, but could not locate it.
Also after following a few threads here, I created a php.ini file in the root directory of the server by copying it from my local server. It did not work. I don't know if I did something wrong here. Is there a way to enable cURL on the server, or to access the php.ini file or any procedure to create my own ini file?
Related
When I fetched 2k data from BigQuery using Google's client library vai my API, everything works perfectly fine. But as soon as I increase the data limit to 3k or more it throws the following error:
curl_exec(): Unable to create temporary file, Check permissions in temporary files directory.
Screenshot of the error.
I'm using postman to test my APIs. And the system is running on top of XAMPP.
I googled the error message but did not find the exact issue I was facing. Again, I tried giving permissions to both /tmp folder in my local machine and /xampfiles/temp folder inside /Applications/XAMPP/xamppfiles but nothing worked and I'm still getting the same error. I increased many limit parameters like output_buffering, memory_limit, execution_time etc in php.ini file as I was not sure what to do.
The issue seems too trivial but it's giving me headache. I would be glad if anyone could help me.
If upload_tmp_dir is not defined in /etc/php.ini, then Apache uses /tmp
Ensure that whichever temp directory you are using is Apache writeable and has the t sticky bit.
Then restart Apache.
I'm trying to download a file locally from a remote server but every time i access the file that contains the PHP code using the browser file_get_contents() fails because it doesn't have the permission to write to /var/www/html (Apache2). I tried using cURL but that didn't work either, checked to see if allow_url_fopen is on (it is) and added the php file to sudoers. I can't seem to find any solution online.
i think this is permission issue, see this maybe will solve your problem, pick that suit to your enviroment.
I have set up an apache2 server on the pi, but when trying to run any php file (placed in /var/www/html) the web page just responds with HTTP error 500. I have ran the index.html file and it works fine its only when php scripts are run that it gives me an error. I have also made sure that the php5 module is enabled in the apache configuration settings. Any advice on what to test from here would greatly help.
Update: Seems there was a problem with the permissions of the file. By giving read and write privileges by all users to the file it worked.
I just downloaded and installed the wamp server but the file php.ini file can not be found anywhere although the configuration page shows
C:\wamp64\bin\apache\apache2.4.17\bin\php.ini
I was wondering if somebody knows the root cause.
Is it possible to get the file from somewhere for that version?
Yes, you can get that file really easy. It's a php configuration file. If you know your installed php version go to PHP net
and download it for your version.
In there you will find php.ini-production(production settings) and php.ini-development (development setting better suited for debugging). Pick one and rename it to php.ini (php as name for file and ini being extension). Now you are ready to go after you copy it to your installation folder.
Make sure to resart your server after applying the changes.
My problem is that I can't include a file on a remote server.
<?php
echo "Including\n";
require_once("http://xx.xxx.xxx.xx:8080/path/to/myfile.inc");
echo "Done..\n";
?>
The script fails at the require_once function.
I'm running the script with: php -d allow_url_include=On script.php
but to make sure I have set allow_url_include and allow_url_fopen to On in php.ini
If I copy http://xx.xxx.xxx.xx:8080/path/to/myfile.inc to the browser I'm served the file.
I have also tried to include other remote files (on standard port 80), but still no luck
Where I get really confused is that everything works from my local computers at my office (mac, ubuntu), but not from our servers. I have tested it on 2 different servers, a virtual and a dedicated.
I can get the file with fopen().
This can be done by setting allow_url_include to on on php.ini.
But, as mentioned in comments, this opens a
huge
security hole on your application.
Require_Once should be used for local files only. If you want to get a remote file use file_get_contents. Remember if you are trying to include php from a remote server like that, it will be really insecure or the php will be executed on the remote server.