I have a file named index.php which using a mysql server gets a simple username. The mysql server is running on centOS and I have two different systems running apache serving as web servers.
One is my own windows pc using a "wamp" solution which uses the mysql server refereed before and the other is the centOS server itself.
I use this so I can develop in my laptop and run the final on the centOS box.
The problem is this:
Accessing centOS box I get (on hxxp://centos):
out_sider 1lu�s 2oi
Using wamp on windows I get (on hxxp://localhost):
out_sider 1luís 2oi
The mysql database is configured correctly seeing that both use the same and I used svn repository to move files from windows to centOS so the file is the same.
Does anyone have any suggestions?
Thanks in advnce
My first guess is its probably a locale thing, try adding or updating locale settings of the centOS, or try controlling it from PHP.
str = iconv(mb_detect_encoding(str)/*or insert the encoding type if you know it*/, "UTF-8", str);
and try also:
str = mb_convert_encoding (str, "UTF-8");
Also try connecting and querying the MYSQL server directly, to rule out the fact that it maybe the MYSQL table charset (on centOS) or something.
Related
We have an IIS on our Windows Server 2016 Standard which use via fast cgi a php 7.3.4 32bit.
To build a connection to a oracle 12cR1 database on another server we use the php_oci8_12c.dll and the oracle client 12.1.0 32bit.
This works fantastic. Now we want to switch to php 64bit, but for some old projects we still need the 32bit php and oracle client.
So we do the follow:
1. Uninstall the oracle client
2. Install oracle client 12.1.0 64 bit (install type: administration) in C:\Oracle\product\12.1.0\client_x64
3. Restart server
4. Configure the net manager
5. Install oracle client 12.1.0 32 bit (install type: administration) in C:\Oracle\product\12.1.0\client_x86
4. Restart server
5. Configure the net manager
6. Download php 7.3.4 64 bit with the 64 bit extensions
Now we have two php folders:
C:\php7_3_4_x86
C:\php7_3_4_x64
At this time the IIS use the C:\php7_3_4_x86\php-cgi.exe and the 32bit oracle client, because its the latest installed client and the path is the first of all paths in the PATH variable.
Now we want to switch temporary to 64bit. So we try the follow steps:
1. Change in IIS handler to C:\php7_3_4_x64\php-cgi.exe
2. Swap the oracle clients path in the environment variable PATH. Now its: C:\Oracle\product\12.1.0\client_x64;C:\Oracle\product\12.1.0\client_x86;[...]
3. Restart the server
After restart we try to open a php file in browser, but we get the follow error:
Call to undefined function oci_connect
If we put the oci.dll from C:\Oracle\product\12.1.0\client_x64\BIN directly into the C:\php7_3_4_x64 it loads the file. So we think it cannot find the 64bit client.
We also try the method with create a link in C:\Windows\system32 / SYSWOW64, but this doesnt work. Same error.
What could we do? We need the possibility to switch between 32&64bit php+oracle.
Problem solved.
Everything was correctly, but the oracle setup forgot the correct windows right for the clientx64 folder.
At the clientx86 the group "authenticated user" (in german: Authentifizierter Benutzer) has full access, while the clientx64 doesnt have this group.
After adding the group and give it full access to the clientx64 folder it works. It isn't necessary to switch the entries in the PATH variable. PHP try to loading the first element and after failing it loads the second element in PATH variable.
So everything works!
I just did a fresh install of Apache server 2.2.
Everything works. When I go to localhost I get: "It Works!"
I just installed mySQL5.5 and when I go to localhost:3306 I just get gibberish:
J���
5.5.22�'���4[LM{D~p�ÿ÷!�€����������6[I=4/+,9z{|�mysql_native_password�!��ÿ„#08S01Got
packets out of order
I see many posts on the internet with users with similar problems, but I can't figure out a solution.
Can anyone help?
The mysql service is not a web interface - you cannot connect using a browser. You will need to install a mysql client of some kind.
If you try to start phpmyadmin then do it like this:
localhost/phpmyadmin
I'm a jsp beginner.
I have a same problem with you.
I guess it's kind of port problem.
For me, I had set the port for Apache server connector as 9090.
Later, when I installed mysql, the port for mysql was 3306 as its default port.
In my jsp file,
i loaded jdbc driver like 'jdbc:mysql://localhost:9090/dbname'
and then i call 'http://localhost:9090/my.jsp' on my web browser.
That's when I got the same problem with you.
I fixed the port part in my jsp file like 'jdbc:mysql://localhost:3306/dbname'
and I could get it all right.
I think you need to check the port for your Apache server.
You can check out \conf\server.xml file in your Apache directory.
The part starts with "Connector port=8080...." in server.xml file.
If so, you need to put 'http://localhost:8080... on your browser.
Try just to write http://localhost/ without the port and it will work , Or go to your phpmyadmin and click on My websites and it will take you immediately to your localhost
I'm having exactly the same problem, so far I have :
1)Manually changed the Collation (it seemed to be defaulting to cp850)
2)altered the ini/cnf file (located under services.msc -> MySQL)
3)Changed the max_packet_size to 2G
3)rebooted the server.
As a start to this please run this script from MySQL
'SHOW VARIABLES WHERE Variable_name LIKE 'character_set_%' OR Variable_name LIKE 'collation%';'
It should bring up a table of your collations, they should all read utf8
Possible causes
I tested a simple Php program using Sqlite3 instead of mySQL on my own computer and it works fine. What the program does is simple insert of record into a certain table. Now, when I try to do that on a remote web server running on Linux (CentOS) with Sqlite3 enabled it does not work.
I thought at first it was simply a file permission issue since my Sqlite file had an initial permissions of 644 so I changed it to 646 then 767 both to no avail.
The Php version by the way on web server is a little bit dated, namely, Php 5.1.6 but on my local PC it is 5.5.11.
This is the sample code that I ran on both servers.
$db = new PDO('sqlite:test.db');
$lastname = "Doe";
$firstname = "John";
$sql = "INSERT INTO people (Lastname,Firstname) VALUES (:lastname,:firstname)";
$q = $db->prepare($sql);
$q->execute(array(':lastname'=>$lastname,
':firstname'=>$firstname));
I tried a simple query on a sqlite3 database on the webserver by the way and it works.
So, could this be a simple Php version issue?
I cannot by the way change the php.ini so forgo that possible direction for the moment. And I don't have any choice of having a new Php version on that server since I use it for free.
Is there any way to have Cassandra PDO at Windows with Wamp?
This is for development purposes I don't want to install Linux and change all the environment.
https://code.google.com/a/apache-extras.org/p/cassandra-pdo/
I'm using Windows 7 (64 Bit), Wamp 2.5, PHP 5.5.
OK, here's what I found out:
1) It's totally possible
2) The docs that appear in the first google search results are a bit obsolete
Start by downloading the latest Datastax Community Cassandra here:
http://planetcassandra.org/cassandra/
Install & setup properly. In fact, most of the configuration is done by the installer, you just have to edit the apache-cassandra/conf/cassandra.yaml file to find all paths to /var/lib... and change those into something like d:/cassandra/... That includes "commitlog", "data", "saved_caches". Restart the Cassandra service, examine the logs. Mine shown no problem. The OpsCenter at ...:8888/opscenter/index.html was working fine, showing one node online.
Now, the PHP part.
There's a sneaky thing called Thrift. From what I've learned today (I first heard about Cassandra and Thrift yesterday), it's a way describe a binary protocol of connecting to some online service, in this case, to Cassandra. It will basically generate PHP files that will provide all the connectivity you need from PHP itself (no extensions needed).
You will need:
1) The Thrift PHP libs
2) The .exe Thrift compiler
Both can be downloaded here:
https://thrift.apache.org/download
Then use the following command to compile PHP files that will act as a "driver" to connect your PHP applications to Cassandra:
thrift --gen php D:\DataStaxCommunity\apache-cassandra\interface\cassandra.thrift
Put the result in some PHP include_path folder.
Also, find the PHP Thrift libs (in the libs archive from the same download page) and put those in a folder accessible to your script (e.g. include_path or the project folder).
Refer this page:
thrift.apache.org/lib/php
I guess that should help!
I have same problem as you, but when i tried this method, it works correctly for me.
Reference link
Here is a code example, very easy to understand :
<?php
require_once 'Cassandra/Cassandra.php';
$o_cassandra = new Cassandra();
$s_server_host = '127.0.0.1'; // Localhost
$i_server_port = 9042;
$s_server_username = ''; // We don't use username
$s_server_password = ''; // We don't use password
$s_server_keyspace = 'cassandra_tests';
$o_cassandra->connect($s_server_host, $s_server_username, $s_server_password, $s_server_keyspace, $i_server_port);
$s_cql = "CREATE TABLE carles_test_table (s_thekey text, s_column1 text, s_column2 text,PRIMARY KEY (s_thekey));";
$st_results = $o_cassandra->query($s_cql);
I use Apache 2.2.22 and PHP 5.4.0 with MySQL 5.5.22.
Installed the same page on two of my servers and on one server instead of " there is a #34; displayed.
Apache, PHP and MySQL configs are the same. Why is this happening ?
Look your MYSQL var with :
SHOW VARIABLES LIKE 'character_set%';
If something different between your two servers, modify your my.cnf file.
It was libxml2 issue. I've restored it from default CentOS repo and now it's ok :)