PHP mkdir issue - php

mkdir("/people/jason", 0700, TRUE);
TRUE = Recursive in PHP 5 and the server is running 5.2.5 but I get:
Warning: mkdir() expects at most 2 parameters, 3 given in
/home/net1003/public_html/admin/_createPage.inc on line 5

are you running this particular script through the command line interface instead? it's possible that version of PHP 4, whereas the mod_php version is 5.

That is all of my code.
I want to create a directory on the web server after a user is added to the MySQL database.
Each user gets their own directory with a default index.php page and I am trying to do this programatically rather than manually.

Related

Symfony 3.4 Where to Put Auto-Generating Proxy Class Config Mode?

Symfony is complaining about renaming proxy classes during my multiple instance command execution. Basically, I am running a Symfony command mutliple times at the same time, and it is throwing an error for generated proxy classes not being able to be renamed...
In ProxyGenerator.php line 293:
Warning: rename(/Users/jlroberts/Projects/Shred/Symfony/var/cache/dev/doctrine/orm/Proxies/__CG__AppBundleEntityNslocaleCountryNames.php.5ee27c106fc5f0.51071995,/Users/jlroberts/Projects/Shred/Symfony/var/cache/dev/doctrine/orm/Proxies/__CG__AppBundleEntityNslocaleCountryNames.php): No such file or directory
I found this issue on github
https://github.com/doctrine/common/issues/327
And I think it says to set the AutoGeneratedProxyClasses to AUTOGENERATE_FILE_NOT_EXISTS, which I found on
https://www.doctrine-project.org/projects/doctrine-orm/en/latest/reference/advanced-configuration.html
Which says I use this following line to set that mode
$mode = AUTOGENERATE_FILE_NOT_EXISTS;
$config->setAutoGenerateProxyClasses($mode);
but where do I put that line?

MySQL 8.0 + phpMyAdmin + docker [caching_sha2_password error]

As mentioned by others (Ref 1,
Ref 2 and Ref 3) the current phpMyAdmin version (4.8.2) + MySQL 8.0.11 + PHP 7.2.8 doesn't work as expected.
The error happens when you try to open phpMyAdmin, where it shows an error message:
#2054 - The server requested authentication method unknown to the client
mysqli_real_connect(): The server requested authentication method unknown to the client [caching_sha2_password]
mysqli_real_connect(): (HY000/2054): The server requested authentication method unknown to the client
As stated in MySQL migration manual here, and described as the solution in Ref 2, you can correct this by executing the following mysql query inside docker:
ALTER USER root IDENTIFIED WITH mysql_native_password BY 'ROOTPASSWORD';
(In order to run this, I use docker exec -it CONTAINERID bash and execute mysql command)
And it works. The main problem is that I need to fire this query as soon as the container starts (the current method is manual and far from scalable). I assume it's possible in different ways:
By executing a PHP script that runs the query after everything has been setup (IMO this is unsafe )
By running the above command in a bash after everything has been setup
The first one is unsafe IMO as the mysql user must have high privileges, although there will be only the root user when this script runs. I haven't tested it yet.
The seconde one is the best IMO, but I can't figure it out how to implement using Dockerfile, as everything I type there runs BEFORE mysql and phpMyAdmin are installed. How could I achieve that?
My current Dockerfile can be seen here and the docker-compose.yml can be seen here.
As a simple solution, you can build your custom mysql image and run the command there. Then mysql will start with this modification already in place.

Failed opening required database.inc (attempting to use drupal)

I am trying to setup a drupal web server with FreeBSD.
When I try to access the drupal index i am greeted with:
Fatal error: require_once(): Failed opening required
'/usr/local/www/apache24/data/drupal/includes/database/sqlite/database.inc'
(include_path='.:/usr/local/share/pear') in
/usr/local/www/apache24/data/drupal/includes/database/database.inc on
line 1685
I am new to freeBSD but i tried setting chmod 667 to the:
sqlite/database.inc
database/database.inc
sqlite
database
Also, i do not understand why it is looking for /usr/local/share/pearas there is no such directory.
I am using MySQL55, PHP5, Drupal-7, and Apache.
I think this might be related but when i access the install.php i get:
Undefined index: distribution_name in drupal_install_profile_distribution_name() (line 201 of /usr/local/www/apache24/data/drupal/includes/install.inc).
did you use drush?
That looks as if you already installed drupal, or at least drupal thinks so. and also with the wrong database settings. normally, you will be prompted to enter them in the web interface, but you also can enter them directly in the settings php. Propably you should just move the old settings.php and run install.php in your browser and enter the database details anew.
drupal_install_profile_distribution_name can be changed in the database under system->standard_profile and variable->install_profiles directly or using drush (www.drush.ws) with
vset install_profile standard
or any other install profile you used.
Anyways, the install script asks for that as well.
hope, this was your problem.

Php ssh2_auth_password authentication failed

My php script generates an excel file, and I'd like this file to be transfered on our files server, which is different from the web one.
I'm using the ssh2_auth_password() function, but I'm stuck with the Warning: ssh2_auth_password() [function.ssh2-auth-password]: Authentication failed for root using password message.
Most of time, this issue is fixed by changing the line PasswordAuthentication yes on the sshd_config file. This is done and confirmed by the function ssh2_auth_none() which returns an array containing : "0: publickey, 1: password, 2: keyboard-interactive"
When I execute the operation by putty (typing scp /srv/www/htdocs/**** root#192.168.168.1:/***/***), and giving the password, it works.
Any ideas ?
Finally, I just had to remove the ssh2_auth_none(), and it works !

Installing Akelos - Fatal Error

I'm completely new to the Akelos framework, but I am familiar with PHP. When I came across the framework I knew it was exactly what I was looking for but for the life of me I cannot get it to install properly.
Here are the steps that I went through and the details of my environment:
I am on a Mac Intel, using MAMP as my main environment
I have copied the Akelos files into my project folder.
When I navigate to localhost:8888 (as setup by mamp) I first get this error message:
(Warning) Cannot modify header
information - headers already sent by
(output started at
/Users/Salman/Work/_PERSONAL
PROJECTS/Web
Development/PHP_Development/SPM/public/index.php:50)
But when I refreshed the page that warning disappears and I successfully obtain the Akelos Getting Started page
I setup the database configuration, and proceed
I successfully set the language settings
First I get the following error:
(User Error) Could not create or alter
table akelos_migrations using the SQL
CREATE TABLE akelos_migrations ( id
INTEGER NOT NULL AUTO_INCREMENT, name
VARCHAR(255), version
INTEGER, updated_at
DATETIME, created_at
DATETIME,
PRIMARY KEY (id) )TYPE=InnoDB
When I refresh - everything "appears" to work fine and I am taken to to the "Welcome Aboard" page
When I try to run Script / Generate I get the following message:
Warning: mysql_connect(): [2002] No
such file or directory (trying to
connect via
unix:///var/mysql/mysql.sock) in
/Users/Salman/Work/_PERSONAL
PROJECTS/Web
Development/PHP_Development/SPM/vendor/adodb/drivers/adodb-mysql.inc.php
on line 353
Warning: mysql_connect(): No such file
or directory in
/Users/Salman/Work/_PERSONAL
PROJECTS/Web
Development/PHP_Development/SPM/vendor/adodb/drivers/adodb-mysql.inc.php
on line 353
Fatal error: Connection to the
database failed.
mysqlt://salman:******#localhost/socialPM_dev
in /Users/Salman/Work/_PERSONAL
PROJECTS/Web
Development/PHP_Development/SPM/lib/AkActiveRecord/AkDbAdapter.php
on line 66
This happens even if I try to manually create the akelos_migrations table using phpMyAdmin and SQL.
I would love to be able to use this framework - but I absolutely can't get past this!
Well the mysql socket file isnt usually in /var/mysql/mysql.sock on OS X. If you use the Mysql install from Mysql then its in /tmp/mysql.sock by default... The macports version is in /opt/local/var/run/mysql5/mysqld.sock by default. Im not sure where it is in MAMP because i dont use it, but my guess would be somewhere on the MAMP folder structure. You need to find out where it creates its socket and supply the path to it to your conifguration (i assume thats an option on the DB setup screen).

Categories